Web Dev Solutions

Catalin Mititiuc

From 00581b900f0f1d0dc6e972f80daa8438000115e3 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Thu, 25 Jul 2024 14:45:29 -0700 Subject: Capture pan-zoom pointer sooner --- src/modules/pan-zoom.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules/pan-zoom.js') diff --git a/src/modules/pan-zoom.js b/src/modules/pan-zoom.js index e86afe9..11471f6 100644 --- a/src/modules/pan-zoom.js +++ b/src/modules/pan-zoom.js @@ -13,7 +13,10 @@ function restorePanZoomVal(el) { function addEventListeners(svg, el) { svg.addEventListener('wheel', e => zoom(el, e, zoomFactor), { passive: false }); - svg.addEventListener('pointerdown', e => pan(svg, el, e), { passive: false }); + svg.addEventListener('pointerdown', e => { + e.target.setPointerCapture(e.pointerId); + pan(svg, el, e), { passive: false }; + }); } function storePanZoomVal(transformMatrix) { -- cgit v1.2.3