From bd24c88f8cf3a21bd6336ee7307b17eff0757e2c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 2 Feb 2023 21:31:07 +0530 Subject: [PATCH] ... --- src/pyj/read_book/touch.pyj | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/touch.pyj b/src/pyj/read_book/touch.pyj index 4265d0a846..11b01e8888 100644 --- a/src/pyj/read_book/touch.pyj +++ b/src/pyj/read_book/touch.pyj @@ -180,7 +180,9 @@ class TouchHandler: self.start_hold_timer() def handle_touchstart(self, ev): - ev.preventDefault(), ev.stopPropagation() + if ev.cancelable: + ev.preventDefault() + ev.stopPropagation() self.prune_expired_touches() for touch in ev.changedTouches: self.ongoing_touches[touch_id(touch)] = copy_touch(touch) @@ -193,7 +195,9 @@ class TouchHandler: self.start_hold_timer() def handle_touchmove(self, ev): - ev.preventDefault(), ev.stopPropagation() + if ev.cancelable: + ev.preventDefault() + ev.stopPropagation() for touch in ev.changedTouches: t = self.ongoing_touches[touch_id(touch)] if t: @@ -201,7 +205,9 @@ class TouchHandler: self.dispatch_gesture() def handle_touchend(self, ev): - ev.preventDefault(), ev.stopPropagation() + if ev.cancelable: + ev.preventDefault() + ev.stopPropagation() for touch in ev.changedTouches: t = self.ongoing_touches[touch_id(touch)] if t: @@ -214,7 +220,8 @@ class TouchHandler: def handle_touchcancel(self, ev): if ev.cancelable: - ev.preventDefault(), ev.stopPropagation() + ev.preventDefault() + ev.stopPropagation() for touch in ev.changedTouches: tid = touch_id(touch) # noqa: unused-local v'delete self.ongoing_touches[tid]'