Skip to content

Commit f557308

Browse files
christian-byrneDrJKL
authored andcommitted
fix dragging video/image components on Vue nodes triggers node drag (#5922)
Fixed pointer capture behavior on video and image preview components to prevent unintended node dragging. Below video shows behavior after fix: https://github.com/user-attachments/assets/95563a2d-8958-47e1-a19c-977fb539d162 - **What**: Added `data-capture-node="true"` attribute to `VideoPreview.vue` and `ImagePreview.vue` components - **What**: Enhanced `useNodePointerInteractions.ts` composable to detect and handle pointer events on elements with capture attribute Pointer event delegation logic and interaction behavior between preview components and canvas drag operations. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5922-fix-dragging-video-image-components-on-Vue-nodes-triggers-node-drag-2826d73d365081ce83e7fd61510167e2) by [Unito](https://www.unito.io) --------- Co-authored-by: DrJKL <[email protected]>
1 parent 53b78de commit f557308

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { type MaybeRefOrGetter, computed, onUnmounted, ref, toValue } from 'vue'
22

3-
import { isMiddlePointerInput } from '@/base/pointerUtils'
43
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
54
import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
65
import { layoutStore } from '@/renderer/core/layout/store/layoutStore'
@@ -35,12 +34,6 @@ export function useNodePointerInteractions(
3534
const { forwardEventToCanvas, shouldHandleNodePointerEvents } =
3635
useCanvasInteractions()
3736

38-
const forwardMiddlePointerIfNeeded = (event: PointerEvent) => {
39-
if (!isMiddlePointerInput(event)) return false
40-
forwardEventToCanvas(event)
41-
return true
42-
}
43-
4437
// Drag state for styling
4538
const isDragging = ref(false)
4639
const dragStyle = computed(() => {
@@ -59,8 +52,6 @@ export function useNodePointerInteractions(
5952
return
6053
}
6154

62-
if (forwardMiddlePointerIfNeeded(event)) return
63-
6455
const stopNodeDragTarget =
6556
event.target instanceof HTMLElement
6657
? event.target.closest('[data-capture-node="true"]')
@@ -99,8 +90,6 @@ export function useNodePointerInteractions(
9990
}
10091

10192
const handlePointerMove = (event: PointerEvent) => {
102-
if (forwardMiddlePointerIfNeeded(event)) return
103-
10493
if (isDragging.value) {
10594
void handleDrag(event)
10695
}
@@ -140,8 +129,6 @@ export function useNodePointerInteractions(
140129
}
141130

142131
const handlePointerUp = (event: PointerEvent) => {
143-
if (forwardMiddlePointerIfNeeded(event)) return
144-
145132
if (isDragging.value) {
146133
handleDragTermination(event, 'drag end')
147134
}

0 commit comments

Comments
 (0)