* 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">)
| 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. |
no test coverage detected