more turn restriction stuff, and checkboxes, and a bunch of little fixes
[potlatch2.git] / net / systemeD / potlatch2 / controller / SelectedWayNode.as
index 502644b0579547ed2709a3b61fe753111565f4c8..3e3411e236d0017408d43b7119363744054e5d00 100644 (file)
@@ -20,18 +20,18 @@ package net.systemeD.potlatch2.controller {
             if ( way == selectedWay && node == selectedNode )
                 return;
 
-            clearSelection();
+            clearSelection(this);
             controller.setSelectedEntity(node);
-            controller.map.setHighlight(way, { showNodes: true, nodeSelected: node.id });
+            controller.map.setHighlight(way, { hover: false, showNodes: true, nodeSelected: node.id });
             selectedWay = way; initWay = way;
                        selectedIndex = index; initIndex = index;
             selectedNode = node;
         }
                 
-        override protected function clearSelection():void {
+        override protected function clearSelection(newState:ControllerState):void {
             if ( selectedNode != null ) {
                controller.map.setHighlight(selectedWay, { selected: false, showNodes: false, nodeSelected: null });
-                controller.setSelectedEntity(null);
+                if (!newState.isSelectionState()) { controller.setSelectedEntity(null); }
                 selectedNode = null;
                                selectedWay = null;
             }
@@ -56,26 +56,28 @@ package net.systemeD.potlatch2.controller {
                                return d;
                        }
                        var cs:ControllerState = sharedMouseEvents(event, entity);
-                       if (cs) return cs;
-                       return this;
+                       return cs ? cs : this;
         }
 
                override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
                        switch (event.keyCode) {
-                               case 189:                                       return removeNode();    // '-'
-                               case 88:                                        return splitWay();              // 'X'
+                               case 189:                                       return removeNode();                                    // '-'
+                               case 88:                                        return splitWay();                                              // 'X'
+                               case 82:                                        repeatTags(selectedNode); return this;  // 'R'
                                case Keyboard.BACKSPACE:        return deleteNode();
                                case Keyboard.DELETE:           return deleteNode();
                        }
-                       return this;
+                       var cs:ControllerState = sharedKeyboardEvents(event);
+                       return cs ? cs : this;
                }
                
                override public function enterState():void {
             selectNode(initWay,initIndex);
                        Globals.vars.root.addDebug("**** -> "+this);
         }
-               override public function exitState():void {
-            clearSelection();
+               override public function exitState(newState:ControllerState):void {
+                       controller.clipboards['node']=selectedNode.getTagsCopy();
+            clearSelection(newState);
                        Globals.vars.root.addDebug("**** <- "+this);
         }