diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index ee1f876cf2..ae4b72d3f8 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -219,12 +219,11 @@ OpenLayers.Layer.Grid.prototype = do { var row; - - if (newGrid) { + + row = this.grid[rowidx++]; + if (!row) { row = new Array(); this.grid.push(row); - } else { - row = this.grid[rowidx++]; } tileoffsetlon = startLon; @@ -247,12 +246,12 @@ OpenLayers.Layer.Grid.prototype = var px = new OpenLayers.Pixel(x, y); var tile; - if (newGrid) { + tile = row[colidx++]; + if (!tile) { tile = this.addTile(tileBounds, px); tile.draw(); row.push(tile); } else { - tile = row[colidx++]; tile.moveTo(tileBounds, px); }