bugfixes
authorRichard Fairhurst <richard@systemed.net>
Tue, 13 Oct 2009 10:32:21 +0000 (10:32 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 13 Oct 2009 10:32:21 +0000 (10:32 +0000)
net/systemeD/halcyon/POI.as
net/systemeD/halcyon/WayUI.as
net/systemeD/halcyon/styleparser/MapCSS.as

index 6ff1bb8..32dfef0 100644 (file)
@@ -65,15 +65,20 @@ package net.systemeD.halcyon {
                                        }
                                }
 
+                               // name sprite
+                               var a:String, t:TextStyle;
                                if (sl.textStyles[sublayer]) {
-                                       var t:TextStyle=sl.textStyles[sublayer];
-                                       // create name sprite
-                                       if (!name) {
-                                               name=new Sprite();
-                                               var c:DisplayObject=map.getChildAt(map.NAMESPRITE);
-                                               Sprite(c).addChild(name);
-                                       }
-                                       t.writeNameLabel(name,tags[t.text],map.lon2coord(node.lon),map.latp2coord(node.latp));
+                                       t=sl.textStyles[sublayer];
+                                       a=tags[t.text];
+                               }
+
+                               var c:DisplayObject=map.getChildAt(map.NAMESPRITE);
+                               if (a) { 
+                                       if (!name) { name=new Sprite(); Sprite(c).addChild(name); }
+                                       t.writeNameLabel(name,a,map.lon2coord(node.lon),map.latp2coord(node.latp));
+                               } else if (name) {
+                                       Sprite(c).removeChild(name);
+                                       name=null;
                                }
                        }
                        if (!r && iconname!='') {
index 929b25c..bc5c165 100755 (executable)
@@ -188,7 +188,7 @@ package net.systemeD.halcyon {
                                        if (a) {
                                                if (t.font_caps) { a=a.toUpperCase(); }
                                                if (t.text_center && centroid_x) {
-                                                       t.writeNameLabel(roadname,tags[t.text],centroid_x,centroid_y);
+                                                       t.writeNameLabel(roadname,a,centroid_x,centroid_y);
                                                } else {
                                                        writeNameOnPath(roadname,a,t.text_offset ? t.text_offset : 0);
                                                }
index 60bcfea..6c0c9f6 100755 (executable)
@@ -239,7 +239,7 @@ package net.systemeD.halcyon.styleparser {
 
                                // Zoom
                                } else if ((o=ZOOM.exec(css))) {
-                                       if (previous!=oOBJECT) { sc.newObject(); }
+                                       if (previous!=oOBJECT && previous!=oCONDITION) { sc.newObject(); }
 
                                        css=css.replace(ZOOM,'');
                                        var z:Array=parseZoom(o[1]);
@@ -255,8 +255,7 @@ package net.systemeD.halcyon.styleparser {
                                // Condition - [highway=primary]
                                } else if ((o=CONDITION.exec(css))) {
                                        if (previous==oDECLARATION) { saveChooser(sc); sc=new StyleChooser(); }
-                                       if (previous!=oOBJECT && previous!=oZOOM) { sc.newObject(); }
-
+                                       if (previous!=oOBJECT && previous!=oZOOM && previous!=oCONDITION) { sc.newObject(); }
                                        css=css.replace(CONDITION,'');
                                        sc.addCondition(parseCondition(o[1]) as Condition);
                                        previous=oCONDITION;