Allow reroutes to be re-connected (#749)

- Resolves #305
- Allows links to be dragged from inputs to reroutes
This commit is contained in:
filtered
2025-03-12 00:47:26 +11:00
committed by GitHub
parent 35dd90b6b0
commit 5ed264ce8e
4 changed files with 100 additions and 27 deletions

View File

@@ -221,6 +221,25 @@ export class Reroute implements Positionable, LinkSegment, Serialisable<Serialis
?.findNextReroute(withParentId, visited)
}
findSourceOutput() {
const network = this.#network.deref()
const originId = this.linkIds.values().next().value
if (!network || !originId) return
const link = network.links.get(originId)
if (!link) return
const node = network.getNodeById(link.origin_id)
if (!node) return
return {
node,
output: node.outputs[link.origin_slot],
outputIndex: link.origin_slot,
link,
}
}
/** @inheritdoc */
move(deltaX: number, deltaY: number) {
this.#pos[0] += deltaX