Allow floating reroutes to be chained when creating new (#828)

- Resolves #827
This commit is contained in:
filtered
2025-03-23 07:38:11 +11:00
committed by GitHub
parent 2e95ac9a71
commit b254bae5c5
2 changed files with 39 additions and 14 deletions

View File

@@ -636,14 +636,16 @@ export class LGraphCanvas implements ConnectionColorContext {
type_filter_out: firstLink.fromSlot.type,
}
const afterRerouteId = firstLink.fromReroute?.id
if ("shiftKey" in e && e.shiftKey) {
if (this.allow_searchbox) {
this.showSearchBox(e as unknown as MouseEvent, linkReleaseContext)
}
} else if (this.linkConnector.state.connectingTo === "input") {
this.showConnectionMenu({ nodeFrom: firstLink.node, slotFrom: firstLink.fromSlot, e })
this.showConnectionMenu({ nodeFrom: firstLink.node, slotFrom: firstLink.fromSlot, e, afterRerouteId })
} else {
this.showConnectionMenu({ nodeTo: firstLink.node, slotTo: firstLink.fromSlot, e })
this.showConnectionMenu({ nodeTo: firstLink.node, slotTo: firstLink.fromSlot, e, afterRerouteId })
}
}
})
@@ -5627,7 +5629,7 @@ export class LGraphCanvas implements ConnectionColorContext {
if (!slot) throw new TypeError("Cannot add reroute: slot was null")
if (!opts.e) throw new TypeError("Cannot add reroute: CanvasPointerEvent was null")
const reroute = node.connectFloatingReroute([opts.e.canvasX, opts.e.canvasY], slot)
const reroute = node.connectFloatingReroute([opts.e.canvasX, opts.e.canvasY], slot, afterRerouteId)
if (!reroute) throw new Error("Failed to create reroute")
dirty()