From 8690459093a8b930e7ba4ff6ee4e6931be9aec54 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Tue, 23 Apr 2024 10:22:12 -0700
Subject: Update pan-zoom lib
---
src/modules/panzoom.js | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
(limited to 'src/modules')
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 });
}
};
--
cgit v1.2.3