fix(zoom): prevent zoom when zoomOnScroll is disabled

This commit is contained in:
Braks
2022-03-12 18:28:35 +01:00
parent e4e5e67687
commit afaa038584
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -10,7 +10,7 @@ const {
zoomOnPinch, zoomOnPinch,
panOnScroll, panOnScroll,
panOnScrollMode, panOnScrollMode,
paneMoveable, paneMovable,
onConnect, onConnect,
onNodeDragStart, onNodeDragStart,
onNodeDragStop, onNodeDragStop,
@@ -28,6 +28,7 @@ const {
{ id: 'e1-2', source: '1', target: '2', animated: true }, { id: 'e1-2', source: '1', target: '2', animated: true },
{ id: 'e1-3', source: '1', target: '3' }, { id: 'e1-3', source: '1', target: '3' },
], ],
panOnScroll: true,
}) })
const captureZoomClick = ref(false) const captureZoomClick = ref(false)
@@ -101,8 +102,8 @@ onMoveEnd((flowTransform) => console.log('move end', flowTransform))
</div> </div>
<div> <div>
<label for="panemoveable"> <label for="panemoveable">
paneMoveable paneMovable
<input id="panemoveable" v-model="paneMoveable" type="checkbox" class="vue-flow__panemoveable" /> <input id="panemoveable" v-model="paneMovable" type="checkbox" class="vue-flow__panemoveable" />
</label> </label>
</div> </div>
<div> <div>
+1 -1
View File
@@ -143,7 +143,7 @@ onMounted(async () => {
// if zoom on double click is disabled, we prevent the double click event // if zoom on double click is disabled, we prevent the double click event
if (!store.zoomOnDoubleClick && event.type === 'dblclick') return false 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 // when the target element is a node, we still allow zooming
if ( if (