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

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Sep 5 04:42:27 EDT 2011


Author: erilem
Date: 2011-09-05 01:42:26 -0700 (Mon, 05 Sep 2011)
New Revision: 12327

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
Log:
do not apply client zoom for singleTile layers

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-05 08:42:20 UTC (rev 12326)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-09-05 08:42:26 UTC (rev 12327)
@@ -237,12 +237,6 @@
             // if grid is empty or zoom has changed, we *must* re-tile
             var forceReTile = !this.grid.length || zoomChanged;
 
-            var resolution = this.map.getResolution();
-            var supportedAvailable = this.getServerSupportedResolution(resolution);
-            if(resolution !== supportedAvailable) {
-                bounds = this.map.calculateBounds(null, supportedAvailable);
-            }
-
             // total bounds of the tiles
             var tilesBounds = this.getTilesBounds();            
       
@@ -257,33 +251,41 @@
                     this.initSingleTile(bounds);
                 }
             } else {
-             
+
                 // if the bounds have changed such that they are not even 
                 //  *partially* contained by our tiles (IE user has 
                 //  programmatically panned to the other side of the earth) 
                 //  then we want to reTile (thus, partial true).  
 
-                forceReTile = forceReTile || !tilesBounds.containsBounds(bounds, true);
+                forceReTile = forceReTile ||
+                              !tilesBounds.containsBounds(bounds, true);
+
+                var resolution = this.map.getResolution();
+                var supportedResolution =
+                    this.getServerSupportedResolution(resolution);
+
+                if(resolution !== supportedResolution) {
+                    bounds = this.map.calculateBounds(null, supportedResolution);
+                    if(forceReTile) {
+                        // stretch the layer div
+                        var scale = supportedResolution / resolution;
+                        this.transformDiv(scale);
+                    }
+                } else {
+                    // reset the layer width, height, left, top, to deal with
+                    // the case where the layer has been transformDivd
+                    this.div.style.width = '100%';
+                    this.div.style.height = '100%';
+                    this.div.style.left = '0%';
+                    this.div.style.top = '0%';
+                }
+
                 if(forceReTile) {
                     this.initGriddedTiles(bounds);
                 } else {
                     this.scheduleMoveGriddedTiles();
                 }
             }
-
-            if(resolution !== supportedAvailable) {
-                if(forceReTile) {
-                    // stretch the layer div
-                    this.transformDiv(supportedAvailable / resolution);
-                }
-            } else {
-                // reset the layer width, height, left, top, to deal with
-                // the case where the layer has been transformDivd
-                this.div.style.width = '100%';
-                this.div.style.height = '100%';
-                this.div.style.left = '0%';
-                this.div.style.top = '0%';
-            }
         }
     },
 



More information about the Commits mailing list