Fix render issues after moving floating input links (#841)

- Fixes floating inputs have invisible segment after moving
- Fixes floating input can be moved onto existing input link, resulting
in the slot having two links
This commit is contained in:
filtered
2025-03-24 11:16:06 +11:00
committed by GitHub
parent 7b8f01f546
commit fd4ffbc1f8
3 changed files with 28 additions and 4 deletions

View File

@@ -96,12 +96,12 @@ export class FloatingRenderLink implements RenderLink {
this.fromPos = fromReroute.pos
}
canConnectToInput(): true {
return true
canConnectToInput(): boolean {
return this.toType === "input"
}
canConnectToOutput(): true {
return true
canConnectToOutput(): boolean {
return this.toType === "output"
}
canConnectToReroute(reroute: Reroute): boolean {
@@ -118,6 +118,8 @@ export class FloatingRenderLink implements RenderLink {
floatingLink.target_id = node.id
floatingLink.target_slot = node.inputs.indexOf(input)
node.disconnectInput(node.inputs.indexOf(input))
this.fromSlot._floatingLinks?.delete(floatingLink)
input._floatingLinks ??= new Set()
input._floatingLinks.add(floatingLink)

View File

@@ -622,6 +622,7 @@ export class LinkConnector {
for (const link of outputLinks) delete link._dragging
for (const link of inputLinks) delete link._dragging
for (const link of floatingLinks) delete link._dragging
for (const reroute of hiddenReroutes) delete reroute._dragging
renderLinks.length = 0