Skip to main content

Class: RestoreGeometry

Defined in: diagram/commands.ts:30

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 Signature

get title(): TranslatedText

Defined in: diagram/commands.ts:59

Command title to display in the UI.

Returns

TranslatedText

Command title to display in the UI.

Implementation of

Command.title

Methods

filterOutUnchanged()

filterOutUnchanged(): RestoreGeometry

Defined in: diagram/commands.ts:78

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


hasChanges()

hasChanges(): boolean

Defined in: diagram/commands.ts:67

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

Returns

boolean


invoke()

invoke(): RestoreGeometry

Defined in: diagram/commands.ts:89

Performs the command action.

Returns

RestoreGeometry

Inverse command to reverse changes done by the action.

Implementation of

Command.invoke


capture()

static capture(graph): RestoreGeometry

Defined in: diagram/commands.ts:41

Creates RestoreGeometry command with captured geometry for all diagram content.

Parameters

ParameterType

graph

GraphStructure

Returns

RestoreGeometry


capturePartial()

static capturePartial(elements, links): RestoreGeometry

Defined in: diagram/commands.ts:49

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

Parameters

ParameterType

elements

readonly Element[]

links

readonly Link[]

Returns

RestoreGeometry