From 70a349f7e1949e8c4c2f191fc93db9004317b196 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 25 Mar 2022 17:14:45 +0100 Subject: [PATCH] fix(zoom): prevent scroll when zoom on scroll is false --- src/container/ZoomPane/ZoomPane.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/container/ZoomPane/ZoomPane.vue b/src/container/ZoomPane/ZoomPane.vue index 4ec07a31..ac19326b 100644 --- a/src/container/ZoomPane/ZoomPane.vue +++ b/src/container/ZoomPane/ZoomPane.vue @@ -105,7 +105,12 @@ onMounted(async () => { -(deltaY / currentZoom) * store.panOnScrollSpeed, ) } else { - if (!store.preventScrolling || isWrappedWithClass(event, store.noWheelClassName)) return null + if ( + (!store.zoomOnScroll && store.preventScrolling) || + !store.preventScrolling || + isWrappedWithClass(event, store.noWheelClassName) + ) + return null event.preventDefault() } }) @@ -116,8 +121,7 @@ onMounted(async () => { const pinchZoom = store.zoomOnPinch && event.ctrlKey // if all interactions are disabled, we prevent all zoom events - if (!store.panOnDrag && !zoomScroll && !store.panOnScroll && !store.zoomOnDoubleClick && !store.zoomOnPinch) - return false + if (!store.panOnDrag && !zoomScroll && !store.panOnScroll && !store.zoomOnDoubleClick && !store.zoomOnPinch) return false // during a selection we prevent all other interactions if (selectionKeyPressed.value) return false