Fix moving existing links can result in loopback (#838)

Prevents nodes connecting links to themselves when moving existing
links.

If moving multiple links with reroutes, this will instead _reconnect_
any links that would become loopbacks, only without any rereoutes.
This commit is contained in:
filtered
2025-03-24 06:00:55 +11:00
committed by GitHub
parent ff6281c840
commit 05587d8a19
8 changed files with 187 additions and 54 deletions

View File

@@ -2330,6 +2330,14 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
return null
}
canConnectTo(
node: LGraphNode,
toSlot: INodeInputSlot,
fromSlot: INodeOutputSlot,
) {
return this.id !== node.id && LiteGraph.isValidConnection(fromSlot.type, toSlot.type)
}
/**
* Connect an output of this node to an input of another node
* @param slot (could be the number of the slot or the string with the name of the slot)