Skip to content

Commit 8108aaa

Browse files
authored
Allow connection to subgraphIOs in vue mode (#6016)
Adds support for link connections from nodes to subgraphInputs and subgraphOutputs when in vue mode. ![vue-subgraphio](https://github.com/user-attachments/assets/5b1ef66f-d45a-40c7-ace0-932aaf811e1d) Resolves #5706 Known Issues - Creating a connection from a widget does not trigger an update of the widget to the disabled state ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6016-Allow-connection-to-subgraphIOs-in-vue-mode-2896d73d3650816cbd88f645dced87df) by [Unito](https://www.unito.io)
1 parent 9c245e9 commit 8108aaa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/renderer/core/canvas/links/linkConnectorAdapter.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { LinkConnector } from '@/lib/litegraph/src/canvas/LinkConnector'
55
import type { RenderLink } from '@/lib/litegraph/src/canvas/RenderLink'
66
import type { CanvasPointerEvent } from '@/lib/litegraph/src/types/events'
77
import { app } from '@/scripts/app'
8+
import { isSubgraph } from '@/utils/typeGuardUtil'
89

910
// Keep one adapter per graph so rendering and interaction share state.
1011
const adapterByGraph = new WeakMap<LGraph, LinkConnectorAdapter>()
@@ -130,6 +131,15 @@ export class LinkConnectorAdapter {
130131

131132
/** Drops moving links onto the canvas (no target). */
132133
dropOnCanvas(event: CanvasPointerEvent): void {
134+
//Add extra check for connection to subgraphInput/subgraphOutput
135+
if (isSubgraph(this.network)) {
136+
const { canvasX, canvasY } = event
137+
const ioNode = this.network.getIoNodeOnPos?.(canvasX, canvasY)
138+
if (ioNode) {
139+
this.linkConnector.dropOnIoNode(ioNode, event)
140+
return
141+
}
142+
}
133143
this.linkConnector.dropOnNothing(event)
134144
}
135145

0 commit comments

Comments
 (0)