Press N to move to other end of way
authorRichard Fairhurst <richard@systemeD.net>
Sat, 4 Jul 2015 17:21:16 +0000 (18:21 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Sat, 4 Jul 2015 17:21:16 +0000 (18:21 +0100)
net/systemeD/potlatch2/controller/SelectedWay.as
net/systemeD/potlatch2/controller/SelectedWayNode.as

index 55d1726..8c5e5ec 100644 (file)
@@ -92,6 +92,7 @@ package net.systemeD.potlatch2.controller {
                        }
                        if (!layer.isBackground) {
                                switch (event.keyCode) {
+                                       case 78:  /* N */               otherEnd(); return this;
                                        case 80:  /* P */       return new SelectedParallelWay(firstSelected as Way); 
                                        case 81:  /* Q */       Quadrilateralise.quadrilateralise(firstSelected as Way, MainUndoStack.getGlobalStack().addAction); return this;
                                        case 86:  /* V */       Way(firstSelected).reverseNodes(MainUndoStack.getGlobalStack().addAction); return this;
@@ -123,6 +124,12 @@ package net.systemeD.potlatch2.controller {
                        return new NoSelection();
                }
 
+               /** Jump to the other end of the way **/
+               public function otherEnd():void {
+                       var n:Node = initWay.getFirstNode().within(map.edge_l, map.edge_r, map.edge_t, map.edge_b) ? initWay.getLastNode() : initWay.getFirstNode();
+               controller.map.scrollIfNeeded(n.lat,n.lon);
+               }
+
         /** Officially enter this state by marking the previously nominated way as selected. */
         override public function enterState():void {
             if (firstSelected!=initWay) {
index dff8ae5..ecc9e29 100644 (file)
@@ -77,6 +77,7 @@ package net.systemeD.potlatch2.controller {
                        switch (event.keyCode) {
                                case 189:                                       return removeNode();                                    // '-'
                                case 88:                                        return splitWay();                                              // 'X'
+                               case 78:                                        return otherEnd();                                              // 'N'
                                case 79:                                        return replaceNode();                                   // 'O'
                 case 81:  /* Q */           Quadrilateralise.quadrilateralise(parentWay, MainUndoStack.getGlobalStack().addAction); return this;
                 case 82:  /* R */           { if (! event.shiftKey) repeatTags(firstSelected); 
@@ -266,6 +267,13 @@ package net.systemeD.potlatch2.controller {
             return new SelectedWayNode(parentWay, ni);
         }
 
+               /** Jump to the other end of the way **/
+               public function otherEnd():ControllerState {
+                       var n:Node = parentWay.getFirstNode().within(map.edge_l, map.edge_r, map.edge_t, map.edge_b) ? parentWay.getLastNode() : parentWay.getFirstNode();
+               controller.map.scrollIfNeeded(n.lat,n.lon);
+                       return new SelectedWay(parentWay);
+               }
+
     }