MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / setReroute

Method setReroute

src/LGraph.ts:1268–1276  ·  view source on GitHub ↗

* Configures a reroute on the graph where ID is already known (probably deserialisation). * Creates the object if it does not exist. * @param serialisedReroute See SerialisableReroute

({ id, parentId, pos, linkIds, floating }: OptionalProps<SerialisableReroute, "id">)

Source from the content-addressed store, hash-verified

1266 * @param serialisedReroute See {@link SerialisableReroute}
1267 */
1268 setReroute({ id, parentId, pos, linkIds, floating }: OptionalProps<SerialisableReroute, "id">): Reroute {
1269 id ??= ++this.state.lastRerouteId
1270 if (id > this.state.lastRerouteId) this.state.lastRerouteId = id
1271
1272 const reroute = this.reroutes.get(id) ?? new Reroute(id, this)
1273 reroute.update(parentId, pos, linkIds, floating)
1274 this.reroutes.set(id, reroute)
1275 return reroute
1276 }
1277
1278 /**
1279 * Creates a new reroute and adds it to the graph.

Callers 3

configureMethod · 0.95
_pasteFromClipboardMethod · 0.80

Calls 3

getMethod · 0.80
setMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected