Don't allow 1-node ways to be saved
authorRichard Fairhurst <richard@systemeD.net>
Sat, 24 Mar 2012 16:44:17 +0000 (16:44 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Sat, 24 Mar 2012 16:44:17 +0000 (16:44 +0000)
net/systemeD/potlatch2/controller/DrawWay.as
net/systemeD/potlatch2/save/SaveManager.as

index 0101db3..061046b 100644 (file)
@@ -201,10 +201,7 @@ package net.systemeD.potlatch2.controller {
                protected function keyExitDrawing():ControllerState {
                        var cs:ControllerState=stopDrawing();
                        if (selectedWay.length==1) { 
-                               if (MainUndoStack.getGlobalStack().undoIfAction(BeginWayAction)) { 
-                                       return new NoSelection();
-                               }
-                               return deleteWay();
+                               return new NoSelection();
                        }
                        return cs;
                }
@@ -344,6 +341,10 @@ package net.systemeD.potlatch2.controller {
                        controller.setCursor("pen");
                }
                override public function exitState(newState:ControllerState):void {
+                       if (selectedWay.length==1 && !MainUndoStack.getGlobalStack().undoIfAction(BeginWayAction)) { 
+                               selectedWay.remove(MainUndoStack.getGlobalStack().addAction);
+                       }
+
             Way(firstSelected).removeEventListener(Connection.WAY_NODE_REMOVED, fixElastic);
             Way(firstSelected).removeEventListener(Connection.WAY_NODE_ADDED, fixElastic);
 
index 9ea879d..fd3214c 100644 (file)
@@ -6,6 +6,7 @@ package net.systemeD.potlatch2.save {
     import mx.core.Application;
     import mx.core.FlexGlobals;
     import net.systemeD.halcyon.connection.*;
+    import net.systemeD.potlatch2.controller.*;
     import org.iotashan.oauth.*;
 
     public class SaveManager {
@@ -22,6 +23,7 @@ package net.systemeD.potlatch2.save {
         }
 
         private function save(callback:Function, connection:Connection):void {
+                       FlexGlobals.topLevelApplication.theController.setState(new NoSelection());
                        _connection=connection;
             if (connection.hasAccessToken()) {
                 callback();