Dispatch events when the nodes are added or removed from the dupes list. Doesn't...
authorAndy Allan <gravitystorm@gmail.com>
Mon, 8 Nov 2010 18:07:07 +0000 (18:07 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 8 Nov 2010 18:07:07 +0000 (18:07 +0000)
net/systemeD/halcyon/NodeUI.as
net/systemeD/halcyon/connection/Connection.as

index bf4f631..624a567 100644 (file)
@@ -30,6 +30,7 @@ package net.systemeD.halcyon {
                                }
                        }
                        entity.addEventListener(Connection.NODE_MOVED, nodeMoved);
+            entity.addEventListener(Connection.NODE_ALTERED, nodeAltered);
             attachRelationListeners();
                        redraw();
                }
@@ -37,12 +38,17 @@ package net.systemeD.halcyon {
                public function removeEventListeners():void {
                        removeGenericEventListeners();
                        entity.removeEventListener(Connection.NODE_MOVED, nodeMoved);
+            entity.removeEventListener(Connection.NODE_ALTERED, nodeAltered);
                }
 
                public function nodeMoved(event:Event):void {
                    updatePosition();
                }
 
+        private function nodeAltered(event:Event):void {
+            redraw();
+        }
+
                override public function doRedraw():Boolean {
                        if (!paint.ready) { return false; }
                        if (entity.deleted) { return false; }
index 04cd4e9..1aee407 100755 (executable)
@@ -69,6 +69,7 @@ package net.systemeD.halcyon.connection {
         public static var RELATION_RENUMBERED:String = "relation_renumbered";
         public static var TAG_CHANGED:String = "tag_change";
         public static var NODE_MOVED:String = "node_moved";
+        public static var NODE_ALTERED:String = "node_altered";
         public static var WAY_NODE_ADDED:String = "way_node_added";
         public static var WAY_NODE_REMOVED:String = "way_node_removed";
         public static var WAY_REORDERED:String = "way_reordered";
@@ -365,6 +366,9 @@ package net.systemeD.halcyon.connection {
               nodePositions[a] = [];
             }
             nodePositions[a].push(node);
+            for each (var n:Node in nodePositions[a]) {
+              n.dispatchEvent(new Event(Connection.NODE_ALTERED));
+            }
         }
 
         public function removeDupe(node:Node):void {
@@ -377,6 +381,9 @@ package net.systemeD.halcyon.connection {
               }
             }
             nodePositions[a] = dupes;
+            for each (var n:Node in nodePositions[a]) {
+              n.dispatchEvent(new Event(Connection.NODE_ALTERED));
+            }
         }
 
         public function nodesAtPosition(lat:Number, lon:Number):uint {