[OpenLayers-Commits] r12330 - sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Sep 5 15:29:40 EDT 2011


Author: erilem
Date: 2011-09-05 12:29:39 -0700 (Mon, 05 Sep 2011)
New Revision: 12330

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
Log:
make Grid.transformDiv correctly translate the layer div when the layer container div is not at position (0, 0)

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-05 19:29:32 UTC (rev 12329)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-05 19:29:39 UTC (rev 12330)
@@ -349,13 +349,13 @@
         // and translate the layer div as necessary
 
         var size = this.map.getSize();
-        var x = (size.w / 2) * (scale - 1);
-        var y = (size.h / 2) * (scale - 1);
-        var px = this.map.getLayerPxFromViewPortPx(
-            new OpenLayers.Pixel(x, y));
+        var lcX = parseInt(this.map.layerContainerDiv.style.left);
+        var lcY = parseInt(this.map.layerContainerDiv.style.top);
+        var x = (lcX - (size.w / 2.)) * (scale - 1);
+        var y = (lcY - (size.h / 2.)) * (scale - 1);
 
-        this.div.style.left = -px.x + '%';
-        this.div.style.top = -px.y + '%';
+        this.div.style.left = x + '%';
+        this.div.style.top = y + '%';
     },
 
 



More information about the Commits mailing list