From afaa038584c43483d624f651997f7f1c947f7abf Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 12 Mar 2022 18:28:35 +0100 Subject: [PATCH] fix(zoom): prevent zoom when zoomOnScroll is disabled --- examples/Interaction/InteractionExample.vue | 7 ++++--- src/container/ZoomPane/ZoomPane.vue | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/Interaction/InteractionExample.vue b/examples/Interaction/InteractionExample.vue index a6d8a098..07034627 100644 --- a/examples/Interaction/InteractionExample.vue +++ b/examples/Interaction/InteractionExample.vue @@ -10,7 +10,7 @@ const { zoomOnPinch, panOnScroll, panOnScrollMode, - paneMoveable, + paneMovable, onConnect, onNodeDragStart, onNodeDragStop, @@ -28,6 +28,7 @@ const { { id: 'e1-2', source: '1', target: '2', animated: true }, { id: 'e1-3', source: '1', target: '3' }, ], + panOnScroll: true, }) const captureZoomClick = ref(false) @@ -101,8 +102,8 @@ onMoveEnd((flowTransform) => console.log('move end', flowTransform))
diff --git a/src/container/ZoomPane/ZoomPane.vue b/src/container/ZoomPane/ZoomPane.vue index bd7ca5eb..ad5ec7f4 100644 --- a/src/container/ZoomPane/ZoomPane.vue +++ b/src/container/ZoomPane/ZoomPane.vue @@ -143,7 +143,7 @@ onMounted(async () => { // if zoom on double click is disabled, we prevent the double click event if (!store.zoomOnDoubleClick && event.type === 'dblclick') return false - if (noWheel(event) && event.type === 'wheel') return false + if ((!store.zoomOnScroll || noWheel(event)) && event.type === 'wheel') return false // when the target element is a node, we still allow zooming if (