[OpenLayers-Commits] r3570 - sandbox/euzuro/untiled3/lib/OpenLayers/Layer

commits at openlayers.org commits at openlayers.org
Tue Jul 3 14:30:38 EDT 2007


Author: euzuro
Date: 2007-07-03 14:30:36 -0400 (Tue, 03 Jul 2007)
New Revision: 3570

Modified:
   sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
Log:
fix tile size calculation in setTileSize() of Grid. Also fix ptile positioning -- px needs to be upper left, not bottom left

Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js	2007-07-03 18:29:12 UTC (rev 3569)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js	2007-07-03 18:30:36 UTC (rev 3570)
@@ -133,8 +133,8 @@
  
         if (this.singleTile) {
             var tileSize = this.map.getSize().clone();
-            tileSize.h += tileSize.h * (2 * this.buffer);
-            tileSize.w += tileSize.w * (2 * this.buffer);
+            tileSize.h = tileSize.h * this.ratio;
+            tileSize.w = tileSize.w * this.ratio;
             this.setTileSize(tileSize);
         }
 
@@ -234,17 +234,14 @@
         var center = bounds.getCenterLonLat();
         var tileWidth = bounds.getWidth() * this.ratio;
         var tileHeight = bounds.getHeight() * this.ratio;
-
-        //determine new position (upper left corner of new bounds)
-        var ul = new OpenLayers.LonLat(center.lon - (tileWidth/2),
-                                       center.lat - (tileHeight/2));
                                        
         var tileBounds = 
-            new OpenLayers.Bounds(ul.lon,
-                                  ul.lat,
-                                  ul.lon + tileWidth,
-                                  ul.lat + tileHeight);
+            new OpenLayers.Bounds(center.lon - (tileWidth/2),
+                                  center.lat - (tileHeight/2),
+                                  center.lon + (tileWidth/2),
+                                  center.lat + (tileHeight/2));
   
+        var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
         var px = this.map.getLayerPxFromLonLat(ul);
  
         if (!this.grid.length) {
@@ -257,7 +254,7 @@
             tile.draw();
             this.grid[0][0] = tile;
         } else {
-            tile.moveTo(tileBounds, px, false);
+            tile.moveTo(tileBounds, px);
         }           
     },
  



More information about the Commits mailing list