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

@@ -2597,8 +2597,8 @@ export class LGraphCanvas implements ConnectionColorContext {
let highlightPos: Point | undefined
let highlightInput: INodeInputSlot | undefined
if (!firstLink || firstLink.node === node) {
// No link / node loopback
if (!firstLink || !linkConnector.isNodeValidDrop(node)) {
// No link, or none of the dragged links may be dropped here
} else if (linkConnector.state.connectingTo === "input") {
if (inputId === -1 && outputId === -1) {
// Allow support for linking to widgets, handled externally to LiteGraph