add + and T keypresses
authorRichard Fairhurst <richard@systemed.net>
Thu, 2 Sep 2010 11:22:52 +0000 (11:22 +0000)
committerRichard Fairhurst <richard@systemed.net>
Thu, 2 Sep 2010 11:22:52 +0000 (11:22 +0000)
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/controller/ControllerState.as
net/systemeD/potlatch2/controller/DrawWay.as

index 15094eb..f6cdb3f 100644 (file)
@@ -10,7 +10,7 @@ package net.systemeD.potlatch2 {
     public class EditController implements MapController {
 
         private var _map:Map;
-        private var tagViewer:TagViewer;
+        public var tagViewer:TagViewer;
                private var toolbox:Toolbox;
         
         public var state:ControllerState;
index 9566247..1f3e3ef 100644 (file)
@@ -56,7 +56,7 @@
             <mx:LinkButton label="?" click="openDescription()" id="helpLabel" styleName="helpInfo"/>
         </mx:HBox>
       </mx:VBox>
-      <mx:VBox width="100%" height="100%" label="Advanced" initialize="checkAdvanced()" verticalGap="1">
+      <mx:VBox width="100%" height="100%" label="Advanced" id="advancedContainer" initialize="checkAdvanced()" verticalGap="1">
         <mx:Label id="advancedID">
           <mx:htmlText><![CDATA[<i>No Selection</i>]]></mx:htmlText>
         </mx:Label>
        }
 
 
+       public function togglePanel():void {
+               if (stack.selectedChild==editorContainer && selectedEntity!=null) {
+                       stack.selectedChild=advancedContainer;
+               } else if (stack.selectedChild!=editorContainer) {
+                       stack.selectedChild=editorContainer;
+               }
+       }
+
       private function checkAdvanced():void {
           if ( selectedEntity != null )
              setupAdvanced(selectedEntity);
       }
 
       public function addNewTag():void {
+          if (stack.selectedChild!=advancedContainer) { return; }
           var newKey:String = "(new tag)";
           var newTag:Tag = new Tag(selectedEntity, newKey, "(new value)");
           tagDataProvider.addItem(newTag);
index 4a2d433..c056026 100644 (file)
@@ -51,9 +51,11 @@ package net.systemeD.potlatch2.controller {
                
                protected function sharedKeyboardEvents(event:KeyboardEvent):ControllerState {
                        switch (event.keyCode) {
-                               case 68:        controller.map.paint.alpha=1.3-controller.map.paint.alpha; return null; // D
-                               case 87:        if (selectedWay) { return new SelectedWay(selectedWay); }; return null; // W
-                               case 90:        MainUndoStack.getGlobalStack().undo(); return null;                                             // Z
+                               case 68:        controller.map.paint.alpha=1.3-controller.map.paint.alpha; return null; // D - dim
+                               case 84:        controller.tagViewer.togglePanel(); return null;                                                // T - toggle tags panel
+                               case 87:        if (selectedWay) { return new SelectedWay(selectedWay); }; return null; // W - select way
+                               case 90:        MainUndoStack.getGlobalStack().undo(); return null;                                             // Z - undo
+                               case 187:       controller.tagViewer.addNewTag(); return null;                                                  // + - add tag
                        }
                        return null;
                }
index a2ff804..c02c339 100644 (file)
@@ -95,7 +95,7 @@ package net.systemeD.potlatch2.controller {
                                        controller.map.setHighlightOnNodes(selectedWay, { selectedway: true });
                                }
                                lastClickTime=new Date();
-                       } else if ( event.type == MouseEvent.MOUSE_MOVE ) {
+                       } else if ( event.type == MouseEvent.MOUSE_MOVE && elastic ) {
                                mouse = new Point(
                                                  controller.map.coord2lon(event.localX),
                                                  controller.map.coord2latp(event.localY));