Skip to content

Commit 4300eae

Browse files
committed
Check if the wheel event is from an element that wants to capture wheel events
1 parent b0d2b44 commit 4300eae

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
v-if="shouldRenderVueNodes && comfyApp.canvas && comfyAppReady"
3737
:canvas="comfyApp.canvas"
3838
@transform-update="handleTransformUpdate"
39-
@wheel.capture="canvasInteractions.forwardEventToCanvas"
39+
@wheel.capture="handleTransformPaneWheel"
4040
>
4141
<!-- Vue nodes rendered based on graph nodes -->
4242
<VueGraphNode
@@ -369,6 +369,18 @@ useCanvasDrop(canvasRef)
369369
useLitegraphSettings()
370370
useNodeBadge()
371371
372+
const handleTransformPaneWheel = (event: WheelEvent) => {
373+
// Check if the wheel event is from an element that wants to capture wheel events
374+
const target = event.target as HTMLElement
375+
const captureElement = target?.closest('[data-capture-wheel="true"]')
376+
377+
if (captureElement) {
378+
return
379+
}
380+
381+
canvasInteractions.forwardEventToCanvas(event)
382+
}
383+
372384
onMounted(async () => {
373385
useGlobalLitegraph()
374386
useContextMenuTranslation()

src/renderer/extensions/vueNodes/components/LGraphNode.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
dragStyle
4040
]"
4141
v-bind="pointerHandlers"
42-
@wheel="handleWheel"
42+
@wheel="handleNodeWheel"
4343
@contextmenu="handleContextMenu"
4444
>
4545
<div class="flex items-center">
@@ -320,6 +320,19 @@ const handleHeaderTitleUpdate = (newTitle: string) => {
320320
handleNodeTitleUpdate(nodeData.id, newTitle)
321321
}
322322
323+
const handleNodeWheel = (event: WheelEvent) => {
324+
// Check if the wheel event is from an element that wants to capture wheel events
325+
const target = event.target as HTMLElement
326+
const captureElement = target?.closest('[data-capture-wheel="true"]')
327+
328+
if (captureElement) {
329+
// Element wants to capture wheel events, don't forward to canvas
330+
return
331+
}
332+
333+
handleWheel(event)
334+
}
335+
323336
const handleEnterSubgraph = () => {
324337
const graph = app.graph?.rootGraph || app.graph
325338
if (!graph) {

0 commit comments

Comments
 (0)