diff options
Diffstat (limited to 'viewer/src/services/ldzoom.ts')
-rw-r--r-- | viewer/src/services/ldzoom.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/viewer/src/services/ldzoom.ts b/viewer/src/services/ldzoom.ts index c28c2c8..ddf57c0 100644 --- a/viewer/src/services/ldzoom.ts +++ b/viewer/src/services/ldzoom.ts | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | // polyfill still required for IE and Safari, see https://caniuse.com/#feat=resizeobserver | 20 | // polyfill still required for IE and Safari, see https://caniuse.com/#feat=resizeobserver |
21 | import ResizeObserver from 'resize-observer-polyfill'; | 21 | import ResizeObserver from "resize-observer-polyfill"; |
22 | import "hammerjs"; | 22 | import "hammerjs"; |
23 | 23 | ||
24 | /** | 24 | /** |
@@ -54,25 +54,25 @@ export default class LdZoom { | |||
54 | this.updateImageScale(this.scaleFactor); | 54 | this.updateImageScale(this.scaleFactor); |
55 | }).observe(this.containerElement); | 55 | }).observe(this.containerElement); |
56 | 56 | ||
57 | this.containerElement.addEventListener('wheel', wheelEvent => { | 57 | this.containerElement.addEventListener("wheel", wheelEvent => { |
58 | wheelEvent.preventDefault(); | 58 | wheelEvent.preventDefault(); |
59 | const scaleFactor = this.scaleFactor - Math.sign(wheelEvent.deltaY) * this.scrollZoomSpeed; | 59 | const scaleFactor = this.scaleFactor - Math.sign(wheelEvent.deltaY) * this.scrollZoomSpeed; |
60 | this.zoom(wheelEvent.offsetX, wheelEvent.offsetY, scaleFactor); | 60 | this.zoom(wheelEvent.offsetX, wheelEvent.offsetY, scaleFactor); |
61 | }); | 61 | }); |
62 | 62 | ||
63 | const pinchListener = new Hammer(this.containerElement); | 63 | const pinchListener = new Hammer(this.containerElement); |
64 | pinchListener.get('pinch').set({enable: true}); | 64 | pinchListener.get("pinch").set({ enable: true }); |
65 | this.installPinchHandler(pinchListener); | 65 | this.installPinchHandler(pinchListener); |
66 | } | 66 | } |
67 | 67 | ||
68 | private installPinchHandler(pinchListener: HammerManager) { | 68 | private installPinchHandler(pinchListener: HammerManager) { |
69 | let startScaleFactor = 0.0; | 69 | let startScaleFactor = 0.0; |
70 | 70 | ||
71 | pinchListener.on('pinchstart', (pinchEvent: HammerInput) => { | 71 | pinchListener.on("pinchstart", (pinchEvent: HammerInput) => { |
72 | startScaleFactor = this.scaleFactor; | 72 | startScaleFactor = this.scaleFactor; |
73 | }); | 73 | }); |
74 | 74 | ||
75 | pinchListener.on('pinchmove', (pinchEvent: HammerInput) => { | 75 | pinchListener.on("pinchmove", (pinchEvent: HammerInput) => { |
76 | const focusX = pinchEvent.center.x + this.containerElement.scrollLeft; | 76 | const focusX = pinchEvent.center.x + this.containerElement.scrollLeft; |
77 | const focusY = pinchEvent.center.y + this.containerElement.scrollTop; | 77 | const focusY = pinchEvent.center.y + this.containerElement.scrollTop; |
78 | const scaleFactor = pinchEvent.scale * startScaleFactor; | 78 | const scaleFactor = pinchEvent.scale * startScaleFactor; |