Reformat dates. Surprisingly limited options for parsing and displaying dates.
[potlatch2.git] / net / systemeD / potlatch2 / controller / DragWay.as
index 5eeb30d63a70ff27cbea33fee2b0a53cdd7f4faa..3e4ce1fa26e8a84871720120a0e2d37d3e0ceb8b 100644 (file)
@@ -17,7 +17,7 @@ package net.systemeD.potlatch2.controller {
                private const DRAGGING:uint=2;
         
         public function DragWay(way:Way, event:MouseEvent) {
-            selectedWay = way;
+            selection = [way];
             downX = event.localX;
             downY = event.localY;
                        enterTime = (new Date()).getTime();
@@ -28,9 +28,9 @@ package net.systemeD.potlatch2.controller {
             if (event.type==MouseEvent.MOUSE_UP) {
                 if (dragstate==DRAGGING) { 
                   MainUndoStack.getGlobalStack().addAction(
-                          new MoveWayAction(selectedWay, downX, downY, event.localX, event.localY, controller.map)); 
+                          new MoveWayAction(firstSelected as Way, downX, downY, event.localX, event.localY, controller.map)); 
                 }
-                return new SelectedWay(selectedWay);
+                return new SelectedWay(firstSelected as Way);
 
                        } else if ( event.type == MouseEvent.MOUSE_MOVE) {
                                // dragging
@@ -51,8 +51,16 @@ package net.systemeD.potlatch2.controller {
                        }
         }
 
+               override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
+                       if (event.keyCode==27) {
+                               firstSelected.dispatchEvent(new WayDraggedEvent(Connection.WAY_DRAGGED, firstSelected as Way, 0, 0));
+                               return new SelectedWay(firstSelected as Way);
+                       }
+                       return this;
+               }
+
         private function dragTo(event:MouseEvent):ControllerState {
-                       selectedWay.dispatchEvent(new WayDraggedEvent(Connection.WAY_DRAGGED, selectedWay, event.localX-downX, event.localY-downY));
+                       firstSelected.dispatchEvent(new WayDraggedEvent(Connection.WAY_DRAGGED, firstSelected as Way, event.localX-downX, event.localY-downY));
             return this;
         }
         
@@ -61,11 +69,11 @@ package net.systemeD.potlatch2.controller {
                }
 
         override public function enterState():void {
-            controller.map.setHighlight(selectedWay, { highlight: true } );
+            controller.map.setHighlight(firstSelected, { selected: true } );
                        Globals.vars.root.addDebug("**** -> "+this);
         }
-        override public function exitState():void {
-            controller.map.setHighlight(selectedWay, { highlight: false } );
+        override public function exitState(newState:ControllerState):void {
+            controller.map.setHighlight(firstSelected, { selected: false } );
                        Globals.vars.root.addDebug("**** <- "+this);
         }
         override public function toString():String {