fix: move slots outside of zoom pane
* avoids zoom gesture events bubbling to zoom pane and causing elements over flow to trigger zoom when they shouldn't Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -31,22 +31,22 @@ const isInteractive = computed(() => store.nodesDraggable && store.nodesConnecta
|
|||||||
const mapClasses = ['vue-flow__controls']
|
const mapClasses = ['vue-flow__controls']
|
||||||
|
|
||||||
const onZoomInHandler = () => {
|
const onZoomInHandler = () => {
|
||||||
zoomIn?.()
|
zoomIn()
|
||||||
emit('zoom-in')
|
emit('zoom-in')
|
||||||
}
|
}
|
||||||
|
|
||||||
const onZoomOutHandler = () => {
|
const onZoomOutHandler = () => {
|
||||||
zoomOut?.()
|
zoomOut()
|
||||||
emit('zoom-out')
|
emit('zoom-out')
|
||||||
}
|
}
|
||||||
|
|
||||||
const onFitViewHandler = () => {
|
const onFitViewHandler = () => {
|
||||||
fitView?.(props.fitViewParams)
|
fitView(props.fitViewParams)
|
||||||
emit('fit-view')
|
emit('fit-view')
|
||||||
}
|
}
|
||||||
|
|
||||||
const onInteractiveChangeHandler = () => {
|
const onInteractiveChangeHandler = () => {
|
||||||
store.setInteractive?.(!isInteractive.value)
|
store.setInteractive(!isInteractive.value)
|
||||||
emit('interaction-change', !isInteractive.value)
|
emit('interaction-change', !isInteractive.value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -51,10 +51,17 @@ onMounted(() => {
|
|||||||
|
|
||||||
useKeyPress(props.selectionKeyCode, (keyPressed) => (selectionKeyPresed.value = keyPressed))
|
useKeyPress(props.selectionKeyCode, (keyPressed) => (selectionKeyPresed.value = keyPressed))
|
||||||
})
|
})
|
||||||
|
const userSelection = computed(() => selectionKeyPresed.value && (store.selectionActive || store.elementsSelectable))
|
||||||
|
const nodesSelectionActive = computed(() => store.nodesSelectionActive)
|
||||||
|
</script>
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
inheritAttrs: false,
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<UserSelection v-if="selectionKeyPresed && (store.selectionActive || store.elementsSelectable)" id="user-selection" />
|
<UserSelection v-if="userSelection" id="user-selection" />
|
||||||
<NodesSelection v-if="store.nodesSelectionActive" id="nodes-selection" />
|
<NodesSelection v-if="nodesSelectionActive" id="nodes-selection" />
|
||||||
<div class="vue-flow__pane" @click.self="onClick" @contextmenu="onContextMenu" @wheel="onWheel" />
|
<div class="vue-flow__pane" @click="onClick" @contextmenu="onContextMenu" @wheel="onWheel" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -186,8 +186,8 @@ const edgeTypes = computed(() => {
|
|||||||
</template>
|
</template>
|
||||||
</EdgeRenderer>
|
</EdgeRenderer>
|
||||||
</SelectionPane>
|
</SelectionPane>
|
||||||
<slot v-bind="{ ...props, store, hooks }"></slot>
|
|
||||||
</ZoomPane>
|
</ZoomPane>
|
||||||
|
<slot v-bind="{ ...props, store, hooks }"></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ invoke(async () => {
|
|||||||
|
|
||||||
const keyPress = useKeyPress(props.selectionKeyCode)
|
const keyPress = useKeyPress(props.selectionKeyCode)
|
||||||
d3z.filter((event: MouseEvent) => {
|
d3z.filter((event: MouseEvent) => {
|
||||||
|
event.stopPropagation()
|
||||||
|
event.stopImmediatePropagation()
|
||||||
|
event.preventDefault()
|
||||||
const pinchZoom = props.zoomOnPinch && event.ctrlKey
|
const pinchZoom = props.zoomOnPinch && event.ctrlKey
|
||||||
|
|
||||||
// if all interactions are disabled, we prevent all zoom events
|
// if all interactions are disabled, we prevent all zoom events
|
||||||
|
|||||||
Reference in New Issue
Block a user