[OpenLayers-Commits] r1778 - trunk/openlayers/lib/OpenLayers

commits at openlayers.org commits at openlayers.org
Wed Nov 8 11:01:40 EST 2006


Author: crschmidt
Date: 2006-11-08 11:01:39 -0500 (Wed, 08 Nov 2006)
New Revision: 1778

Modified:
   trunk/openlayers/lib/OpenLayers/Map.js
Log:
A fix for #366 , this prevents bailing out in the case where originPx
can't be determined from the baselayer yet. This is the case in Google,
because Google can't call getLatLonFromPx until after setCenter has been
called, which comes after this. There may be some cases where this isn't 
a perfect fix, but we're going to fix this for now, and punt on further
testing until 2.3.


Modified: trunk/openlayers/lib/OpenLayers/Map.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Map.js	2006-11-08 15:43:17 UTC (rev 1777)
+++ trunk/openlayers/lib/OpenLayers/Map.js	2006-11-08 16:01:39 UTC (rev 1778)
@@ -786,8 +786,10 @@
         var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
         var newPx = this.getViewPortPxFromLonLat(lonlat);
 
-        this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";
-        this.layerContainerDiv.style.top  = (originPx.y - newPx.y) + "px";
+        if ((originPx != null) && (newPx != null)) {
+            this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";
+            this.layerContainerDiv.style.top  = (originPx.y - newPx.y) + "px";
+        }
     },
 
     /**



More information about the Commits mailing list