Skip to main content

Class: CommandContext

Constructors​

Constructor​

new CommandContext(): CommandContext

Returns​

CommandContext

Methods​

apply()​

apply(command, leaveOffUndoStack?): void

Parameters​

command​

CanvasCommand

leaveOffUndoStack?​

boolean

Returns​

void


flattenSequence()​

flattenSequence(sequenceId, initialState): void

Find all commands in history with the given sequence ID, discard all but the last and overwrite its oldState.

Parameters​

sequenceId​

string

initialState​

LayoutsState

Returns​

void


getAllLayouts()​

getAllLayouts(): LayoutData[]

Returns​

LayoutData[]


getLayoutById()​

getLayoutById(layoutId): LayoutData

Parameters​

layoutId​

string

Returns​

LayoutData


getState()​

getState(): CommandState | undefined

Returns​

CommandState | undefined


initialize()​

initialize(layouts, reloadedState?): void

Parameters​

layouts​

ILayout[]

reloadedState?​

LayoutsState

Returns​

void


redo()​

redo(): void

Returns​

void


registerStateCallback()​

registerStateCallback(callback): void

Parameters​

callback​

() => void

Returns​

void


undo()​

undo(): void

Returns​

void


unregisterStateCallback()​

unregisterStateCallback(callback): void

Parameters​

callback​

() => void

Returns​

void


updateLayouts()​

updateLayouts(newLayouts): void

Updates the layout structure without losing canvas state. Migrates existing layout states to new panel configurations.

Parameters​

newLayouts​

ILayout[]

Returns​

void