Skip to content

Commit 32b6b7e

Browse files
authored
Fix reroutes lost when moving links via outputs (#699)
- Resolves #309 https://github.com/user-attachments/assets/70c8b9ba-b4e6-4293-a254-6ae95930d1f1
1 parent 10f2f2c commit 32b6b7e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/LGraphCanvas.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,8 @@ export class LGraphCanvas implements ConnectionColorContext {
22362236
if (isInRectangle(x, y, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) {
22372237
// Drag multiple output links
22382238
if (e.shiftKey && output.links?.length) {
2239-
this.connecting_links = []
2239+
const connectingLinks: ConnectingLink[] = []
2240+
22402241
for (const linkId of output.links) {
22412242
const link = graph._links.get(linkId)
22422243
if (!link) continue
@@ -2245,18 +2246,21 @@ export class LGraphCanvas implements ConnectionColorContext {
22452246
const otherNode = graph._nodes_by_id[link.target_id]
22462247
const input = otherNode.inputs[slot]
22472248
const pos = otherNode.getConnectionPos(true, slot)
2249+
const firstRerouteId = LLink.getReroutes(graph, link).at(0)?.id
22482250

2249-
this.connecting_links.push({
2251+
connectingLinks.push({
22502252
node: otherNode,
22512253
slot,
22522254
input,
22532255
output: null,
22542256
pos,
22552257
direction: LinkDirection.RIGHT,
2258+
afterRerouteId: firstRerouteId,
22562259
link,
22572260
})
22582261
}
22592262

2263+
this.connecting_links = connectingLinks
22602264
return
22612265
}
22622266

0 commit comments

Comments
 (0)