[OpenLayers-Commits] r12305 -
sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Aug 31 14:42:20 EDT 2011
Author: erilem
Date: 2011-08-31 11:42:20 -0700 (Wed, 31 Aug 2011)
New Revision: 12305
Modified:
sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
Log:
Grid.transformDiv only worked with scale=2, which can be improved
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js 2011-08-31 15:08:02 UTC (rev 12304)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js 2011-08-31 18:42:20 UTC (rev 12305)
@@ -264,7 +264,6 @@
//
if (forceReTile || !tilesBounds.containsBounds(bounds, true)) {
this.initGriddedTiles(bounds);
- this.recenterTiles();
} else {
this.scheduleMoveGriddedTiles();
}
@@ -283,7 +282,6 @@
this.div.style.left = '0%';
this.div.style.top = '0%';
}
-
}
},
@@ -347,21 +345,12 @@
// and translate the layer div as necessary
- this.recenterTiles();
- },
-
- /**
- * Method: rencenterTiles
- * After scaling the layer div or retiling the tiles aren't correctly
- * positioned. This function moves the layer div to move the tiles as
- * appropriate.
- */
- recenterTiles: function() {
var size = this.map.getSize();
- var origin = this.map.getLayerPxFromViewPortPx(
- new OpenLayers.Pixel(size.w / 2, size.h / 2));
- this.div.style.left = -origin.x + '%';
- this.div.style.top = -origin.y + '%';
+ var x = (size.w / 2) * (scale - 1);
+ var y = (size.h / 2) * (scale - 1);
+
+ this.div.style.left = -x + '%';
+ this.div.style.top = -y + '%';
},
More information about the Commits
mailing list