delete points from ways
authorRichard Fairhurst <richard@systemed.net>
Tue, 9 Mar 2010 21:44:19 +0000 (21:44 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 9 Mar 2010 21:44:19 +0000 (21:44 +0000)
TODO.txt
net/systemeD/halcyon/NodeUI.as
net/systemeD/halcyon/connection/Way.as
net/systemeD/potlatch2/controller/SelectedWayNode.as

index 39d7b77..d4c540e 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -9,7 +9,7 @@ Potlatch 2: main outstanding issues
 
 == Core geometry ==
 
-* Delete points and ways
+* Delete POIs and ways
 * Merge ways (almost there)
 * Undo/redo
 * Reverse way direction
index 479ff6e..b9cd326 100644 (file)
@@ -27,11 +27,16 @@ package net.systemeD.halcyon {
                        this.node = node;
                        this.heading = heading;
                        node.addEventListener(Connection.NODE_MOVED, nodeMoved);
+                       node.addEventListener(Connection.NODE_DELETED, nodeDeleted);
                }
                
                public function nodeMoved(event:Event):void {
                    updatePosition();
                }
+
+               public function nodeDeleted(event:Event):void {
+                       removeSprites();
+               }
                
                override public function redraw(sl:StyleList=null):Boolean {
                        var tags:Object = node.getTagsCopy();
index de13b55..11e30dd 100644 (file)
@@ -60,7 +60,7 @@ package net.systemeD.halcyon.connection {
 
                public function removeNode(node:Node):void {
                        var i:int;
-                       while ((i=nodes.indexOf(i))>-1) {
+                       while ((i=nodes.indexOf(node))>-1) {
                                nodes.splice(i,1);
                dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_REMOVED, node, this, i));
                        }
index 822cfb8..4a5e99b 100644 (file)
@@ -1,5 +1,6 @@
 package net.systemeD.potlatch2.controller {
        import flash.events.*;
+       import flash.ui.Keyboard;
     import net.systemeD.potlatch2.EditController;
     import net.systemeD.halcyon.connection.*;
        import net.systemeD.halcyon.Globals;
@@ -69,7 +70,9 @@ package net.systemeD.potlatch2.controller {
 
                override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
                        switch (event.keyCode) {
-                               case 88:        return splitWay();
+                               case 88:                                        return splitWay();
+                               case Keyboard.BACKSPACE:        return deleteNode();
+                               case Keyboard.DELETE:           return deleteNode();
                        }
                        return this;
                }
@@ -118,6 +121,11 @@ package net.systemeD.potlatch2.controller {
 
                        return new SelectedWay(selectedWay);
                }
+               
+               public function deleteNode():ControllerState {
+                       selectedNode.remove();
+                       return new SelectedWay(selectedWay);
+               }
 
     }
 }