Download on resize
authorRichard Fairhurst <richard@systemeD.net>
Thu, 18 Oct 2012 18:00:32 +0000 (19:00 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Thu, 18 Oct 2012 18:00:32 +0000 (19:00 +0100)
net/systemeD/halcyon/Map.as
potlatch2.mxml

index 833526e..29aded4 100644 (file)
@@ -206,6 +206,7 @@ package net.systemeD.halcyon {
                        mapwidth = w; centre_lon=coord2lon(-getX()+w/2);
                        mapheight= h; centre_lat=coord2lat(-getY()+h/2);
                        setScrollRectSize(w,h);
+                       updateCoords(getX(),getY());
 
                        this.dispatchEvent(new MapEvent(MapEvent.RESIZE, {width:w, height:h}));
                        
index c9b2ce3..5fbe9cb 100644 (file)
                private var saveLabel:String='Save';
                private var saveTimer:Timer;
                private var mouseTimer:Timer;
+               private var resizeTimer:Timer;
 
         include "version.as";
 
                }
 
         public function onResizeMap():void {
-            if ( theMap != null )
-                theMap.updateSize(map_area.width, map_area.height);
+                       if (!theMap) return;
+                       theMap.updateSize(map_area.width, map_area.height);
 
                        if (toolbox) {
                                toolbox.x=Math.min(toolbox.x,suggestToolboxX());
                                toolbox.y=Math.min(toolbox.y,suggestToolboxY());
                        }
+
+                       if (!resizeTimer) {
+                               resizeTimer=new Timer(300);
+                               resizeTimer.addEventListener(TimerEvent.TIMER, resizeMapEnd, false, 0, true);
+                       }
+                       resizeTimer.reset();
+                       resizeTimer.start();
         }
+               private function resizeMapEnd(e:Event):void {
+                       resizeTimer.stop();
+                       theMap.download();
+               }
                private function bumpHandler(e:MapEvent):void {
                        if (toolbox) { 
                                toolbox.y=Math.min(toolbox.y,suggestToolboxY(e.params.y+5));