Unify selection ControllerStates so they can work on either background or editable...
[potlatch2.git] / net / systemeD / potlatch2 / controller / NoSelection.as
index 8737de17632aeac8773179f598791a560798d9c4..5c5072d2242f0fee477dc45f6368d5a89f00e279 100644 (file)
@@ -6,7 +6,6 @@ package net.systemeD.potlatch2.controller {
     import net.systemeD.halcyon.connection.actions.*;
        import net.systemeD.halcyon.Map;
        import net.systemeD.halcyon.MapPaint;
-       import net.systemeD.halcyon.Globals;
 
        public class NoSelection extends ControllerState {
 
@@ -27,11 +26,12 @@ package net.systemeD.potlatch2.controller {
                        if (event.type==MouseEvent.MOUSE_UP && (focus==null || (paint && paint.isBackground)) && map.dragstate!=map.DRAGGING) {
                                map.dragstate=map.NOT_DRAGGING;
                                var undo:CompositeUndoableAction = new BeginWayAction();
-                               var startNode:Node = controller.connection.createNode(
+                               var conn:Connection = layer.connection;
+                               var startNode:Node = conn.createNode(
                                        {}, 
                                        controller.map.coord2lat(event.localY),
                                        controller.map.coord2lon(event.localX), undo.push);
-                               var way:Way = controller.connection.createWay({}, [startNode], undo.push);
+                               var way:Way = conn.createWay({}, [startNode], undo.push);
                                MainUndoStack.getGlobalStack().addAction(undo);
                                return new DrawWay(way, true, false);
                        }
@@ -45,10 +45,8 @@ package net.systemeD.potlatch2.controller {
                
         override public function enterState():void {
                        controller.map.mouseUpHandler();
-                       Globals.vars.root.addDebug("**** -> "+this);
         }
         override public function exitState(newState:ControllerState):void {
-                       Globals.vars.root.addDebug("**** <- "+this);
         }
                override public function toString():String {
                        return "NoSelection";