mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 21:24:57 +02:00
Fix pinch to change font size not working on Safari
This commit is contained in:
parent
6c670b22a4
commit
03b3d93bfc
1 changed files with 8 additions and 3 deletions
|
|
@ -109,6 +109,11 @@ def tap_on_link(gesture):
|
|||
return False
|
||||
|
||||
|
||||
def touch_id(touch):
|
||||
# On Safari using touch.identifier as dict key yields a key of "NaN" for some reason
|
||||
return touch.identifier + ''
|
||||
|
||||
|
||||
class TouchHandler:
|
||||
|
||||
def __init__(self):
|
||||
|
|
@ -162,7 +167,7 @@ def handle_touchstart(self, ev):
|
|||
ev.preventDefault(), ev.stopPropagation()
|
||||
self.prune_expired_touches()
|
||||
for touch in ev.changedTouches:
|
||||
self.ongoing_touches[touch.identifier] = copy_touch(touch)
|
||||
self.ongoing_touches[touch_id(touch)] = copy_touch(touch)
|
||||
if self.gesture_id is None:
|
||||
nonlocal gesture_id
|
||||
gesture_id += 1
|
||||
|
|
@ -180,7 +185,7 @@ def update_touch(self, t, touch):
|
|||
def handle_touchmove(self, ev):
|
||||
ev.preventDefault(), ev.stopPropagation()
|
||||
for touch in ev.changedTouches:
|
||||
t = self.ongoing_touches[touch.identifier]
|
||||
t = self.ongoing_touches[touch_id(touch)]
|
||||
if t:
|
||||
self.update_touch(t, touch)
|
||||
self.dispatch_gesture()
|
||||
|
|
@ -188,7 +193,7 @@ def handle_touchmove(self, ev):
|
|||
def handle_touchend(self, ev):
|
||||
ev.preventDefault(), ev.stopPropagation()
|
||||
for touch in ev.changedTouches:
|
||||
t = self.ongoing_touches[touch.identifier]
|
||||
t = self.ongoing_touches[touch_id(touch)]
|
||||
if t:
|
||||
t.active = False
|
||||
self.update_touch(t, touch)
|
||||
|
|
|
|||
Loading…
Reference in a new issue