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

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Aug 31 02:49:41 EDT 2011


Author: erilem
Date: 2011-08-30 23:49:40 -0700 (Tue, 30 Aug 2011)
New Revision: 12290

Modified:
   sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
Log:
modify Grid.moveTo not to do anything if the bounds are null

Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-08-31 06:49:32 UTC (rev 12289)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Grid.js	2011-08-31 06:49:40 UTC (rev 12290)
@@ -228,15 +228,8 @@
      */
     moveTo:function(bounds, zoomChanged, dragging) {
 
-        var resolution = this.map.getResolution(),
-            availableResolution = this.getAvailableResolution();
-
-        if(resolution !== availableResolution) {
-            bounds = this.map.calculateBounds(null, availableResolution);
-        }
-
         OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments);
-        
+
         bounds = bounds || this.map.getExtent();
 
         if (bounds != null) {
@@ -244,6 +237,12 @@
             // if grid is empty or zoom has changed, we *must* re-tile
             var forceReTile = !this.grid.length || zoomChanged;
 
+            var resolution = this.map.getResolution(),
+                availableResolution = this.getAvailableResolution();
+            if (resolution !== availableResolution) {
+                bounds = this.map.calculateBounds(null, availableResolution);
+            }
+
             // total bounds of the tiles
             var tilesBounds = this.getTilesBounds();            
       
@@ -269,21 +268,21 @@
                     this.scheduleMoveGriddedTiles();
                 }
             }
-        }
 
-        if(resolution !== availableResolution) {
-            if(zoomChanged) {
-                // apply "client zoom"
-                var scale = availableResolution / resolution;
-                this.transformDiv(scale);
+            if (resolution !== availableResolution) {
+                if (forceReTile) {
+                    // stretch the layer div
+                    this.transformDiv(availableResolution / 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%';
             }
-        } 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%';
+
         }
     },
 
@@ -340,11 +339,6 @@
      */
     transformDiv: function(scale) {
 
-        //
-        // TODO
-        // - serverResolutions should be documented
-        //
-
         // scale the layer div with the map center as the
         // origin
 



More information about the Commits mailing list