Prevent parallel way creation leaving entries in Undo stack if way creation is aborted.
authorSteve Bennett <stevagewp@gmail.com>
Sun, 25 Mar 2012 08:48:09 +0000 (19:48 +1100)
committerSteve Bennett <stevagewp@gmail.com>
Sun, 25 Mar 2012 08:48:09 +0000 (19:48 +1100)
net/systemeD/potlatch2/controller/SelectedParallelWay.as

index 8ff494c..4e19bc0 100644 (file)
@@ -4,6 +4,7 @@ package net.systemeD.potlatch2.controller {
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.Map;
        import net.systemeD.potlatch2.tools.Parallelise;
+       import net.systemeD.halcyon.connection.actions.*;
 
     /** The state midway during the use of the "parallelise tool", where a parallel way has been created but is stuck to the 
     * mouse cursor, allowing the user to choose how far from the original way it should go. This transforms it in the process. */
@@ -36,6 +37,10 @@ package net.systemeD.potlatch2.controller {
                override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
                        if (event.keyCode==27) {                        // Escape
                                Way(firstSelected).remove(MainUndoStack.getGlobalStack().addAction);
+                               // Parallel way wasn't created, so remove it from undo history.
+                               MainUndoStack.getGlobalStack().removeLastIfAction(DeleteWayAction);
+                MainUndoStack.getGlobalStack().removeLastIfAction(CreateEntityAction);
+                               
                                return new NoSelection();
                        }
                        var cs:ControllerState = sharedKeyboardEvents(event);