change relation.appendMember to use the undo system, and update various places as...
[potlatch2.git] / net / systemeD / halcyon / connection / actions / DeleteWayAction.as
index da515955a64e88afa1cd64da9c165fc1ee6a512b..3ed4e856f332d3de1b6e875167bc8d73b0f551d9 100644 (file)
@@ -26,9 +26,11 @@ package net.systemeD.halcyon.connection.actions {
                        oldNodeList = nodeList.slice();
                        while (nodeList.length > 0) {
                                node=nodeList.pop();
-                               way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_REMOVED, node, way, 0));
                                node.removeParent(way);
-                               if (!node.hasParents) { node.remove(effects.push); }
+                               way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_REMOVED, node, way, 0));
+                if (!node.hasParents && !node.hasInterestingTags()) { //need to trigger redraw of new POIs?
+                  node.remove(effects.push);
+                }
                        }
                        effects.doAction();
                        setDeleted(true);
@@ -39,7 +41,7 @@ package net.systemeD.halcyon.connection.actions {
             } else {
               markDirty();
             }
-            way.dispatchEvent(new EntityEvent(Connection.WAY_DELETED, way));
+                       way.dispatchEvent(new EntityEvent(Connection.WAY_DELETED, way));        // delete WayUI
                        way.resume();
 
             return SUCCESS;
@@ -54,13 +56,14 @@ package net.systemeD.halcyon.connection.actions {
             } else {
               markClean();
             }
-            way.dispatchEvent(new EntityEvent(Connection.NEW_WAY, way));
+            Connection.getConnection().dispatchEvent(new EntityEvent(Connection.NEW_WAY, way));
             effects.undoAction();
             for each(var node:Node in oldNodeList) {
                 nodeList.push(node);
+               node.addParent(way);
                 way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_ADDED, node, way, 0));
             }
-            way.resume();
+                       way.resume();
             return SUCCESS;
         }
     }