DWVv0.37.0

UndoController

Source: undoController.js:18

Undo controller.


Constructor

new UndoController(): UndoController

Constructor.


Instance Methods

addToUndoStack(cmd: object)

Add a command to the undo stack.

Parameters

  • cmd (object) — The command to add.

Fires

  • UndoStack#event:undoadd

removeFromUndoStack(name: string): boolean

Remove a command from the undo stack.

Parameters

  • name (string) — The name of the command to remove.

Returns

  • boolean — True if the command was found and removed.

Fires

  • UndoStack#event:undoremove

undo()

Undo the last command.

Fires

  • UndoStack#event:undo

redo()

Redo the next command.

Fires

  • UndoStack#event:redo

getStackSize(): number

Get the undo stack size.

Returns

  • number — The size of the stack.

getCurrentStackIndex(): number

Get the current undo stack index.

Returns

  • number — The stack index.

reset()

Reset the undo/redo history.