Draw new markers when they are created, and save the data loaders from worrying about...
authorAndy Allan <andy@gravitystorm.co.uk>
Mon, 23 May 2011 16:06:42 +0000 (17:06 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Mon, 23 May 2011 16:06:42 +0000 (17:06 +0100)
net/systemeD/halcyon/MapPaint.as
net/systemeD/potlatch2/utils/BugLoader.as

index f87cfee..b00149b 100644 (file)
@@ -67,6 +67,7 @@ package net.systemeD.halcyon {
             connection.addEventListener(Connection.NEW_POI, newPOICreatedListener);
             connection.addEventListener(Connection.WAY_RENUMBERED, wayRenumberedListener);
             connection.addEventListener(Connection.NODE_RENUMBERED, nodeRenumberedListener);
+            connection.addEventListener(Connection.NEW_MARKER, newMarkerCreatedListener);
 
                        // Add paint sprites
                        for (l=minlayer; l<=maxlayer; l++) {                    // each layer (10 is +5, 0 is -5)
@@ -369,6 +370,12 @@ package net.systemeD.halcyon {
                        createNodeUI(node);
         }
 
+        private function newMarkerCreatedListener(event:EntityEvent):void {
+            var marker:Marker = event.entity as Marker;
+            if (!marker.within(map.edge_l, map.edge_r, map.edge_t, map.edge_b)) { return; }
+            createMarkerUI(marker);
+        }
+
                private function wayRenumberedListener(event:EntityRenumberedEvent):void {
             var way:Way = event.entity as Way;
                        renumberWayUI(way,event.oldID);
index 34ca32a..b9532cb 100644 (file)
@@ -31,8 +31,6 @@ package net.systemeD.potlatch2.utils {
 
         public function load():void {
             connection.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
-            // FIXME Note this fires too early, since loadBbox is asynchronous
-            layer.updateEntityUIs(true, false);
         }
 
         private function get layer():MapPaint {