+/- tooltips with current zoom level
authorRichard Fairhurst <richard@systemed.net>
Mon, 1 Nov 2010 13:40:22 +0000 (13:40 +0000)
committerRichard Fairhurst <richard@systemed.net>
Mon, 1 Nov 2010 13:40:22 +0000 (13:40 +0000)
net/systemeD/halcyon/Map.as
net/systemeD/halcyon/MapEvent.as
potlatch2.mxml

index ab36a73..6e83556 100755 (executable)
@@ -133,7 +133,10 @@ package net.systemeD.halcyon {
                                paint.ruleset=new RuleSet(MINSCALE,MAXSCALE,redraw,redrawPOIs);
                                paint.ruleset.loadFromCSS(styleurl);
                        }
-                       if (startscale>0) { scale=startscale; }
+                       if (startscale>0) {
+                               scale=startscale;
+                               this.dispatchEvent(new MapEvent(MapEvent.SCALE, {scale:scale}));
+                       }
 
                        scalefactor=MASTERSCALE/Math.pow(2,13-scale);
                        baselon    =startlon          -(mapwidth /2)/scalefactor;
@@ -332,6 +335,7 @@ package net.systemeD.halcyon {
                private function changeScale(newscale:uint):void {
                        addDebug("new scale "+newscale);
                        scale=newscale;
+                       this.dispatchEvent(new MapEvent(MapEvent.SCALE, {scale:scale}));
                        scalefactor=MASTERSCALE/Math.pow(2,13-scale);
                        updateCoordsFromLatLon((edge_t+edge_b)/2,(edge_l+edge_r)/2);    // recentre
                        tileset.changeScale(scale);
index b0f090f..cb125f5 100644 (file)
@@ -7,6 +7,7 @@ package net.systemeD.halcyon {
                public static const DOWNLOAD:String = "download";
                public static const RESIZE:String = "resize";
                public static const MOVE:String = "move";
+               public static const SCALE:String = "scale";
                public static const NUDGE_BACKGROUND:String = "nudge_background";
                public static const ERROR:String = "error";
 
index ff05912..79735e5 100755 (executable)
@@ -59,9 +59,9 @@
             top="0" left="0" width="100%" height="100%" dragEnter="dragEnterHandler(event);" dragDrop="dragDropHandler(event);">
         </mx:Canvas>
         <mx:Image source="@Embed('embedded/zoomIn.svg')" right="3" top="3" click="theMap.zoomIn();"
-            rollOverEffect="glowImage" rollOutEffect="unglowImage"/>
+            rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom in - currently z'+getScale()}" />
         <mx:Image source="@Embed('embedded/zoomOut.svg')" right="3" top="20" click="theMap.zoomOut();"
-            rollOverEffect="glowImage" rollOutEffect="unglowImage"/>
+            rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom out - currently z'+getScale()}" />
         <mx:TextArea id="dataWorking" text="" right="20" top="3" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="18"
             enabled="false" borderThickness="0"
             showEffect="{wipeIn}" hideEffect="{wipeOut}"/>
                        _root.addChild(yahoo);
                        _root.addChild(theMap);
             theMap.updateSize(w,h);
+                       theMap.addEventListener(MapEvent.SCALE, scaleHandler);
 
                        // add mask for map
                        var s:Sprite=new Sprite();
                        obj.flush();
                }
 
+               private function scaleHandler(event:MapEvent):void {
+                       dispatchEvent(new Event("rescale"));
+               }
+               
+               [Bindable(event="rescale")]
+               private function getScale():String {
+                       return String(theMap.scale);
+               }
 
         private function dragEnterHandler(event:DragEvent):void {
             // Get the drop target component from the event object.