ol/interaction/UndoRedo is an interaction to handle undo/redo on a map.
Experimental
this feature is still in progress and may be buggy.
Just add the interaction to the map to get it working.
It will watch all vector sources and all interactions in the map.
-
Use the undo() and redo() method to undo the last recorded operations.
-
The shift() method lets you remove an operation from the undo stack.
-
Use the getStack() method to have a list of current undo actions in the stack.
-
change:add, change:remove or change:clear events
are triggered when the undo stack change.
-
Undo can be stacked in a block to make them undoing at a time.
Just enclose the operation between a blockStart() and blockEnd().
-
You can stack operation on a map by enclosing operations beetween
undoblockstart and undoblockend events
(map.dispatchEvent('undoblockstart') and map.dispatchEvent('undoblockend')).
-
Use setMaxLength() and setMaxSize() methods to set the max stack length and max heap size.
Cancelable operations:
-
ol/source/Vector
addFeature / removeFeature / clear
The core clear function has been overwritten to fires
a clearstart and clearend event
Cancelable interactions:
To add your own cancelable actions, look at
this example.