[OpenLayers-Commits] r12419 - sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Sep 28 03:48:33 EDT 2011


Author: erilem
Date: 2011-09-28 00:48:32 -0700 (Wed, 28 Sep 2011)
New Revision: 12419

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js
Log:
more fixes for back buffer

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js	2011-09-27 14:52:43 UTC (rev 12418)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/BackBufferable.js	2011-09-28 07:48:32 UTC (rev 12419)
@@ -90,6 +90,22 @@
      * Returns:
      * {DOMElement} A copy of the tile's markup.
      */
+
+    /**
+     * Method: getTileResolution
+     * Get the tile's actual resolution.
+     *
+     * Returns:
+     * {Number}
+     */
+    getTileResolution: function() {
+        var layer = this.layer,
+            map = layer.map,
+            mapResolution = map.getResolution();
+        return layer.getServerSupportedResolution ?
+                   layer.getServerSupportedResolution(mapResolution) :
+                   mapResolution;
+    },
     
     /**
      * Method: setBackBufferData
@@ -99,7 +115,7 @@
     setBackBufferData: function() {
         this.backBufferData = OpenLayers.Util.extend(this.backBufferData, {
             bounds: this.bounds,
-            resolution: this.layer.map.getResolution()
+            resolution: this.getTileResolution()
         });
     },
     
@@ -119,12 +135,9 @@
             data = this.backBufferData,
             tile = this.getTile(),
             backBuffer = data.tile,
-            mapResolution = map.getResolution(),
             prevResolution = data.resolution,
-            currResolution = layer.getServerSupportedResolution ?
-                                 layer.getServerSupportedResolution(mapResolution) :
-                                 mapResolution,
-            ratio = prevResolution ? prevResolution / currResolution : 1,
+            nextResolution = this.getTileResolution(),
+            ratio = prevResolution ? prevResolution / nextResolution : 1,
             
         // Cases where we don't position and return a back buffer, but only
         // update backBufferData and return undefined:
@@ -154,7 +167,7 @@
 
         // Position the back buffer now that we have one
         var lonLat = {lon: data.bounds.left, lat: data.bounds.top},
-            position = layer.getViewPortPxFromLonLat(lonLat, currResolution),
+            position = layer.getViewPortPxFromLonLat(lonLat, nextResolution),
             containerStyle = map.layerContainerDiv.style,
             leftOffset = parseInt(containerStyle.left, 10),
             topOffset = parseInt(containerStyle.top, 10),



More information about the Commits mailing list