Merge remote-tracking branch 'upstream/master'
[potlatch2.git] / potlatch2.mxml
index ddd91d4..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));
                        }
                }
                private function suggestToolboxX():int {
-                       return theMap.localToGlobal(new Point(theMap.width,theMap.height)).x - toolbox.width - 5;
+                       var rhCP:Point=rhContent.localToGlobal(new Point(0,0));
+                       return rhCP.x + theMap.scrollRect.width - toolbox.width - 5;
                }
                private function suggestToolboxY(yOffset:int=0):int {
-                       return theMap.localToGlobal(new Point(theMap.width,theMap.height)).y - toolbox.height - 5 - yOffset;
+                       var rhCP:Point=rhContent.localToGlobal(new Point(0,0)); // stage co-ordinates of right-hand content area
+                       return rhCP.y + theMap.scrollRect.height - toolbox.height - 5 - yOffset;
                }
 
                private function disableMapMouse():void {