Class: UndoRedo

ol.interaction. UndoRedo


new UndoRedo(options)

Undo/redo interaction

Parameters:
Name Type Description
options *
Fires:
  • event:undo
  • event:redo

Extends

  • ol.interaction.Interaction

Methods


_onAddRemove()

A feature is added / removed


blockEnd()

End an undo block


blockStart()

Start an undo block


clear()

Clear undo stack


define(action, undoFn, redoFn)

Add a custom undo/redo

Parameters:
Name Type Description
action string

the action key name

undoFn function

function called when undoing

redoFn function

function called when redoing


hasRedo()

Check if redo is avaliable

Returns:

the number of redo

Type
number

hasUndo()

Check if undo is avaliable

Returns:

the number of undo

Type
number

push(action, prop)

Set a custom undo/redo

Parameters:
Name Type Description
action string

the action key name

prop any

an object that will be passed in the undo/redo fucntions of the action

Returns:

true if the action is defined

Type
boolean

redo()

Redo last operation


setActive(active)

Activate or deactivate the interaction, ie. records or not events on the map.

Parameters:
Name Type Description
active boolean

setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.


undo()

Undo last operation