index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-23 10:22:12 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-23 10:22:12 -0700 |
commit | 8690459093a8b930e7ba4ff6ee4e6931be9aec54 (patch) | |
tree | 135e22266260a6cd2b155150201a70023ae70195 | |
parent | bbf65197db8da4f360e3d460d4eb74d947525622 (diff) |
Update pan-zoom lib
-rw-r--r-- | package-lock.json | 9 | ||||
-rw-r--r-- | package.json | 6 | ||||
-rw-r--r-- | src/modules/panzoom.js | 16 |
3 files changed, 12 insertions, 19 deletions
diff --git a/package-lock.json b/package-lock.json index c1865e4..bbd028a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "svg-pan-zoom": "github:webdevcat-me/svg-pan-zoom" + "pan-zoom": "github:webdevcat-me/pan-zoom" }, "devDependencies": { "esbuild": "^0.20.2", @@ -3042,6 +3042,10 @@ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "dev": true }, + "node_modules/pan-zoom": { + "version": "0.1.0", + "resolved": "git+ssh://git@github.com/webdevcat-me/pan-zoom.git#2d3fc1cd22ffcc61ec178eeaf97f3a4d7cba98bf" + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -3486,9 +3490,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/svg-pan-zoom": { - "resolved": "git+ssh://git@github.com/webdevcat-me/svg-pan-zoom.git#e7c191a78d583029192776f90833b8346f0227ff" - }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index 10700e4..f437438 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "type": "module", + "dependencies": { + "pan-zoom": "github:webdevcat-me/pan-zoom" + }, "devDependencies": { "esbuild": "^0.20.2", "esbuild-server": "^0.3.0", @@ -10,8 +13,5 @@ "start": "node dev-server.cjs", "test:integ": "jest --config jest.config.integ.cjs", "test": "jest" - }, - "dependencies": { - "svg-pan-zoom": "github:webdevcat-me/svg-pan-zoom" } } 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 }); } }; |