LONG_TAP_THRESHOLD was never used since the timer to check for it was using HOLD_THRESHOLD so just use HOLD_THRESHOLD

This commit is contained in:
Kovid Goyal 2021-04-04 10:15:19 +05:30
parent 7b6f46df17
commit 4c928a6c30
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -10,7 +10,6 @@ TAP_THRESHOLD = 8 # pixels
SWIPE_THRESHOLD = 64 # pixels
TAP_LINK_THRESHOLD = 5 # pixels
PINCH_THRESHOLD = 20 # pixels
LONG_TAP_THRESHOLD = 500 # milliseconds
gesture_id = 0
@ -159,7 +158,7 @@ class TouchHandler:
def start_hold_timer(self):
self.stop_hold_timer()
self.hold_timer = window.setTimeout(self.check_for_hold, 100)
self.hold_timer = window.setTimeout(self.check_for_hold, 50)
def stop_hold_timer(self):
if self.hold_timer is not None:
@ -243,7 +242,7 @@ class BookTouchHandler(TouchHandler):
gesture.from_side_margin = self.for_side_margin
if gesture.type is 'tap':
if gesture.is_held:
if not self.for_side_margin and not self.handled_tap_hold and window.performance.now() - gesture.start_time >= LONG_TAP_THRESHOLD:
if not self.for_side_margin and not self.handled_tap_hold and window.performance.now() - gesture.start_time >= HOLD_THRESHOLD:
self.handled_tap_hold = True
gesture.type = 'long-tap'
get_boss().handle_gesture(gesture)