[OpenLayers-Commits] r4187 - sandbox/thliese/openlayers/lib/OpenLayers/Layer

commits at openlayers.org commits at openlayers.org
Tue Sep 4 09:56:01 EDT 2007


Author: thliese
Date: 2007-09-04 09:55:59 -0400 (Tue, 04 Sep 2007)
New Revision: 4187

Modified:
   sandbox/thliese/openlayers/lib/OpenLayers/Layer/Map24.js
Log:
fix Map24.js to always remove the readded toolbar when canvas size has changed

Modified: sandbox/thliese/openlayers/lib/OpenLayers/Layer/Map24.js
===================================================================
--- sandbox/thliese/openlayers/lib/OpenLayers/Layer/Map24.js	2007-09-04 11:11:42 UTC (rev 4186)
+++ sandbox/thliese/openlayers/lib/OpenLayers/Layer/Map24.js	2007-09-04 13:55:59 UTC (rev 4187)
@@ -174,6 +174,13 @@
     mapViewChanged:function(e) {
 
         var firstCall = (this.clipRect == null);
+        
+        if (this.canvasWidth != e.Canvas.NodeWidth ||
+            this.canvasHeight != e.Canvas.NodeHeight)
+        {
+            // canvas size has changed. must remove the toolbar
+            e.Canvas.ViewportNode.removeChild(e.MapClient._Toolbar.Node);        	
+        }
     
         this.clipRect = e.ClipRect.clone();
         this.center = e.ClipRect.Center.clone();
@@ -189,11 +196,8 @@
             this.maxExtent.right = e.ClipRect.LowerRight.Longitude/60;
             this.maxExtent.top = e.ClipRect.TopLeft.Latitude/60;
             
-            // remove the stupid toolbar
-            e.Canvas.ViewportNode.removeChild(e.MapClient._Toolbar.Node);
-        	
-        	// calculate the current zoom level from the initial bounds
-        	this.zoom = this.getZoomForExtent(this.maxExtent);
+            // calculate the current zoom level from the initial bounds
+            this.zoom = this.getZoomForExtent(this.maxExtent);
         
             // must redraw all layers including center
             var center = new OpenLayers.LonLat(e.ClipRect.Center.Longitude/60, 



More information about the Commits mailing list