Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-07-25 14:45:29 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-07-25 14:45:29 -0700
commit00581b900f0f1d0dc6e972f80daa8438000115e3 (patch)
tree176a8386f0a66fe5647886fcb80558977e834571 /src/modules/pan-zoom.js
parentf503f974f37f1a1916189a033a1708689d512d35 (diff)
Capture pan-zoom pointer sooner
Diffstat (limited to 'src/modules/pan-zoom.js')
-rw-r--r--src/modules/pan-zoom.js5
1 files changed, 4 insertions, 1 deletions
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) {