Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-04-23 10:22:12 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-04-23 10:22:12 -0700
commit8690459093a8b930e7ba4ff6ee4e6931be9aec54 (patch)
tree135e22266260a6cd2b155150201a70023ae70195 /src/modules
parentbbf65197db8da4f360e3d460d4eb74d947525622 (diff)
Update pan-zoom lib
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/panzoom.js16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/modules/panzoom.js b/src/modules/panzoom.js
index 38b6b08..ae95171 100644
--- a/src/modules/panzoom.js
+++ b/src/modules/panzoom.js
@@ -1,7 +1,8 @@
-import { pan, zoom } from 'svg-pan-zoom';
+import { pan, zoom } from 'pan-zoom';
export default class PanZoom {
#storageKey = 'pan-zoom';
+ #zoomFactor = 0.25;
constructor(svg) {
this.#restorePanZoomVal(svg);
@@ -29,16 +30,7 @@ export default class PanZoom {
}
#addEventListeners(svg) {
- svg.addEventListener('wheel', e => {
- e.preventDefault();
-
- zoom(svg, e);
- }, { passive: false });
-
- svg.addEventListener('pointerdown', e => {
- e.preventDefault();
-
- pan(svg, e);
- }, { passive: false });
+ svg.addEventListener('wheel', e => zoom(svg, e, this.#zoomFactor), { passive: false });
+ svg.addEventListener('pointerdown', e => pan(svg, e), { passive: false });
}
};