Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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 });
}
};