mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A spot of refactoring
This commit is contained in:
parent
9310a3c76e
commit
f608f1545a
@ -204,6 +204,9 @@ class TouchHandler:
|
||||
self.gesture_id = None
|
||||
self.handled_tap_hold = False
|
||||
|
||||
def handle_gesture(self, gesture):
|
||||
pass
|
||||
|
||||
def dispatch_gesture(self):
|
||||
touches = self.ongoing_touches
|
||||
num = len(touches)
|
||||
@ -215,7 +218,11 @@ class TouchHandler:
|
||||
gesture = interpret_double_gesture(touches[t[0]], touches[t[1]], self.gesture_id)
|
||||
if not gesture?.type:
|
||||
return
|
||||
self.handle_gesture(gesture)
|
||||
|
||||
class BookTouchHandler(TouchHandler):
|
||||
|
||||
def handle_gesture(self, gesture):
|
||||
if gesture.type is 'tap':
|
||||
if gesture.is_held:
|
||||
if not self.handled_tap_hold:
|
||||
@ -245,7 +252,7 @@ class TouchHandler:
|
||||
return
|
||||
get_boss().handle_gesture(gesture)
|
||||
|
||||
touch_handler = TouchHandler()
|
||||
touch_handler = BookTouchHandler()
|
||||
|
||||
def create_handlers():
|
||||
window.addEventListener('touchstart', touch_handler.handle_touchstart, True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user