From 849f20e5905aee8a156fc26299f98360b5c496ed Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Mon, 1 Apr 2024 23:21:48 +0300 Subject: [PATCH] fix(zoom): translation in mac os force pointers reset on context menu --- src/zoom.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zoom.ts b/src/zoom.ts index be4e383..9aab38d 100644 --- a/src/zoom.ts +++ b/src/zoom.ts @@ -28,6 +28,7 @@ export class Zoom { window.addEventListener('pointermove', this.move) window.addEventListener('pointerup', this.up) + window.addEventListener('contextmenu', this.contextmenu) window.addEventListener('pointercancel', this.up) } @@ -79,6 +80,10 @@ export class Zoom { this.previous = { cx, cy, distance } } + protected contextmenu = () => { + this.pointers = [] + } + protected up = (e: PointerEvent) => { this.previous = null this.pointers = this.pointers.filter(p => p.pointerId !== e.pointerId)