Import it from @grafloria/engine.
Also has every member of Command, listed on its own entry.
Replace a link's points (its routed polyline, including any user waypoints),
undoable. Each bend gesture on the canvas (insert, move, remove) commits one
of these when the pointer is released.
The hasManualWaypoints metadata flag is part of the state being changed:
the renderer keeps a link's interior points only while that flag is set, so
execute sets it when the new path has bends and undo restores the value it
had before. Without the old value, undoing a bend drag would clear the flag
and the next re-route would drop the bend itself.
tsclass SetLinkPointsCommand extends Command
Parameters
linkId: The link to edit.newPoints: The path to apply.oldPoints: The path to restore on undo. Pass it when the link has already been changed live (during a drag); omitted, the link's points at the first execute are used.oldManual: ThehasManualWaypointsflag to restore on undo. Pass it witholdPointswhen the flag has also been changed live; omitted, the link's flag at the first execute is used.
Methods
constructor( private linkId: string, newPoints: Point[], oldPoints?: Point[], oldManual?: boolean )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(): boolean— One vertex gesture = one undo step; never merge two of them.override serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
Was this page helpful?