fix backspacing issue on self-intersecting ways
authorRichard Fairhurst <richard@systemed.net>
Thu, 8 Jul 2010 10:15:39 +0000 (10:15 +0000)
committerRichard Fairhurst <richard@systemed.net>
Thu, 8 Jul 2010 10:15:39 +0000 (10:15 +0000)
net/systemeD/halcyon/WayUI.as
net/systemeD/halcyon/connection/Way.as
net/systemeD/potlatch2/controller/DrawWay.as
net/systemeD/potlatch2/controller/SelectedWayNode.as

index ea3d14a6aaa0a724e538a4fbbff15fd0c934669e..adcd6ce6babc72896efd2ad918fa1a1b62ae3976 100755 (executable)
@@ -52,7 +52,9 @@ package net.systemeD.halcyon {
                }
                    
                private function wayNodeRemoved(event:WayNodeEvent):void {
-                   event.node.removeEventListener(Connection.NODE_MOVED, nodeMoved);
+                   if (!event.node.hasParent(event.way)) {
+                               event.node.removeEventListener(Connection.NODE_MOVED, nodeMoved);
+                       }
                        if (paint.nodeuis[event.node.id]) {
                                paint.nodeuis[event.node.id].redraw();
                        }
index ebf131c28d200daf0d9ea079f74cd02e605dbc46..cf6f96cb9ce768bf90f01d18ae90e3a72f36e36e 100644 (file)
@@ -78,6 +78,10 @@ package net.systemeD.halcyon.connection {
             return nodes.indexOf(node);
         }
 
+               public function hasOnceOnly(node:Node):Boolean {
+                       return nodes.indexOf(node)==nodes.lastIndexOf(node);
+               }
+
                public function removeNode(node:Node, performAction:Function):void {
                        performAction(new RemoveNodeFromWayAction(this, node, nodes));
                }
index e265b5bc481790d531cb2f90dd072cdb4dc9996f..6a05f9a646fe6f1a49e3b07d0528a367a9d82a99 100644 (file)
@@ -190,7 +190,7 @@ package net.systemeD.potlatch2.controller {
                                selectedWay.removeNodeByIndex(0, undo.push);
                                newDraw=0;
                        }
-                       if (node.numParentWays==1) {
+                       if (node.numParentWays==1 && selectedWay.hasOnceOnly(node)) {
                                controller.connection.unregisterPOI(node);
                                node.remove(undo.push);
                        }
index 3e3411e236d0017408d43b7119363744054e5d00..13e9ba5ca3354b449e071e8bd4574baea01e8d7e 100644 (file)
@@ -108,7 +108,9 @@ package net.systemeD.potlatch2.controller {
                }
                
                public function removeNode():ControllerState {
-                       if (selectedNode.numParentWays==1) { return deleteNode(); }
+                       if (selectedNode.numParentWays==1 && selectedWay.hasOnceOnly(selectedNode)) {
+                               return deleteNode();
+                       }
                        selectedWay.removeNodeByIndex(selectedIndex, MainUndoStack.getGlobalStack().addAction);
                        return new SelectedWay(selectedWay);
                }