Fix reroutes lost when moving links via outputs (#699)

- Resolves #309

https://github.com/user-attachments/assets/70c8b9ba-b4e6-4293-a254-6ae95930d1f1
This commit is contained in:
filtered
2025-03-04 06:16:55 +11:00
committed by GitHub
parent 10f2f2ca67
commit 32b6b7eff9

View File

@@ -2236,7 +2236,8 @@ export class LGraphCanvas implements ConnectionColorContext {
if (isInRectangle(x, y, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { if (isInRectangle(x, y, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) {
// Drag multiple output links // Drag multiple output links
if (e.shiftKey && output.links?.length) { if (e.shiftKey && output.links?.length) {
this.connecting_links = [] const connectingLinks: ConnectingLink[] = []
for (const linkId of output.links) { for (const linkId of output.links) {
const link = graph._links.get(linkId) const link = graph._links.get(linkId)
if (!link) continue if (!link) continue
@@ -2245,18 +2246,21 @@ export class LGraphCanvas implements ConnectionColorContext {
const otherNode = graph._nodes_by_id[link.target_id] const otherNode = graph._nodes_by_id[link.target_id]
const input = otherNode.inputs[slot] const input = otherNode.inputs[slot]
const pos = otherNode.getConnectionPos(true, slot) const pos = otherNode.getConnectionPos(true, slot)
const firstRerouteId = LLink.getReroutes(graph, link).at(0)?.id
this.connecting_links.push({ connectingLinks.push({
node: otherNode, node: otherNode,
slot, slot,
input, input,
output: null, output: null,
pos, pos,
direction: LinkDirection.RIGHT, direction: LinkDirection.RIGHT,
afterRerouteId: firstRerouteId,
link, link,
}) })
} }
this.connecting_links = connectingLinks
return return
} }