index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/modules/pan-zoom.js')
-rw-r--r-- | src/modules/pan-zoom.js | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/modules/pan-zoom.js b/src/modules/pan-zoom.js index 5e224e8..76c77f6 100644 --- a/src/modules/pan-zoom.js +++ b/src/modules/pan-zoom.js @@ -1,27 +1,17 @@ import { pan, zoom } from 'pan-zoom'; -const storageKey = 'pan-zoom', - zoomFactor = 0.25; +const storageKey = 'pan-zoom'; +const zoomFactor = 0.25; function restorePanZoomVal(el) { const storedPanZoomVal = localStorage.getItem(storageKey); - if (storedPanZoomVal) { - el.style.transform = storedPanZoomVal; - } + if (storedPanZoomVal) el.style.transform = storedPanZoomVal; } function addEventListeners(svg, el) { - svg.addEventListener('wheel', e => zoom(el, e, zoomFactor), { passive: false }); - svg.addEventListener('pointerdown', e => { - if (e.button === 0) { - e.target.setPointerCapture(e.pointerId); - pan(svg, el, e), { passive: false }; - } - }); - svg.addEventListener('pointermove', e => { - console.log('clientX,clientY', `${e.clientX},${e.clientY}`); - }); + svg.addEventListener('wheel', zoom(el, zoomFactor), { passive: false }); + svg.addEventListener('pointerdown', pan(el), { passive: false }); } function storePanZoomVal(transformMatrix) { |