AnsweredAssumed Answered

Undo edits of existing graphics using UndoManager

Question asked by vygintasc on Jan 21, 2016
Latest reply on Feb 2, 2016 by schlot

Hi,

 

I am looking for a way to undo edits such as move, scale and rotate of existing graphics on the map. So far I've tried to undo it in the same way as we currently undo 'draw' operations:

 

            var editToolbar = new Edit(map);
            editToolbar.on("scale-stop, vertex-move-stop", function (evt) {
                var operation = new CustomOperation.Add({
                    graphicsLayer: selectedGraphicsLayer,
                    addedGraphic: evt.graphic
                });


                undoManager.add(operation);
            });

 

However this undoes the action that happened directly previous to the 'edit', which in our case was 'draw' and removes the graphic from the map. Am I missing something or should I be using a different method altogether?

 

I'm using following classes:

 

Edit - Edit | API Reference | ArcGIS API for JavaScript

UndoManager - UndoManager | API Reference | ArcGIS API for JavaScript 

Outcomes