From e8379443f05dbb4acc2ffb695ce9ea999cf0949e Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Mon, 1 Nov 2010 13:40:22 +0000 Subject: [PATCH] +/- tooltips with current zoom level --- net/systemeD/halcyon/Map.as | 6 +++++- net/systemeD/halcyon/MapEvent.as | 1 + potlatch2.mxml | 13 +++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/net/systemeD/halcyon/Map.as b/net/systemeD/halcyon/Map.as index ab36a734..6e83556f 100755 --- a/net/systemeD/halcyon/Map.as +++ b/net/systemeD/halcyon/Map.as @@ -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); diff --git a/net/systemeD/halcyon/MapEvent.as b/net/systemeD/halcyon/MapEvent.as index b0f090fb..cb125f53 100644 --- a/net/systemeD/halcyon/MapEvent.as +++ b/net/systemeD/halcyon/MapEvent.as @@ -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"; diff --git a/potlatch2.mxml b/potlatch2.mxml index ff05912b..79735e54 100755 --- a/potlatch2.mxml +++ b/potlatch2.mxml @@ -59,9 +59,9 @@ top="0" left="0" width="100%" height="100%" dragEnter="dragEnterHandler(event);" dragDrop="dragDropHandler(event);"> + rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom in - currently z'+getScale()}" /> + rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom out - currently z'+getScale()}" /> @@ -155,6 +155,7 @@ _root.addChild(yahoo); _root.addChild(theMap); theMap.updateSize(w,h); + theMap.addEventListener(MapEvent.SCALE, scaleHandler); // add mask for map var s:Sprite=new Sprite(); @@ -366,6 +367,14 @@ 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. -- 2.36.1