Skip to main content

Class: RestoreGeometry

Command to restore element positions and link geometry (vertices) on a canvas.

Example:

const capturedGeometry = RestoreGeometry.capture(model);
// ... (move elements, change link vertices) ...
restoreGeometry = capturedGeometry.filterOutUnchanged();
if (restoreGeometry.hasChanges()) {
model.history.registerToUndo(restoreGeometry);
}

Implements

Accessors

title

get title(): TranslatedText

Command title to display in the UI.

Returns

TranslatedText

Command title to display in the UI.

Implementation of

Command.title

Defined in

diagram/commands.ts:59

Methods

filterOutUnchanged()

filterOutUnchanged(): RestoreGeometry

Creates a derived RestoreGeometry command by removing any geometry state which is equal to the current diagram content geometry state.

This is useful to avoid adding a command without actual changes to the command history and to reduce the amount of memory to store captured geometry withing the command.

Returns

RestoreGeometry

Defined in

diagram/commands.ts:78


hasChanges()

hasChanges(): boolean

Returns true if command contains any captured geometry state to restore, otherwise false.

Returns

boolean

Defined in

diagram/commands.ts:67


invoke()

invoke(): RestoreGeometry

Performs the command action.

Returns

RestoreGeometry

Inverse command to reverse changes done by the action.

Implementation of

Command.invoke

Defined in

diagram/commands.ts:89


capture()

static capture(graph): RestoreGeometry

Creates RestoreGeometry command with captured geometry for all diagram content.

Parameters

ParameterType

graph

GraphStructure

Returns

RestoreGeometry

Defined in

diagram/commands.ts:41


capturePartial()

static capturePartial(elements, links): RestoreGeometry

Creates RestoreGeometry command with captured geometry for the specified subset of a diagram content.

Parameters

ParameterType

elements

readonly Element[]

links

readonly Link[]

Returns

RestoreGeometry

Defined in

diagram/commands.ts:49