diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 86ff805d76..cdb6c42835 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -63,27 +63,25 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { } return; } - var gridBounds = this.getGridBounds(); if (!this.grid || zoomChanged) { this._initTiles(); - } else { + } else { var i = 0; - while (gridBounds.bottom > bounds.bottom) { + while (this.getGridBounds().bottom > bounds.bottom) { this.insertRow(false); } - while (gridBounds.left > bounds.left) { + while (this.getGridBounds().left > bounds.left) { this.insertColumn(true); } - while (gridBounds.top < bounds.top) { + while (this.getGridBounds().top < bounds.top) { this.insertRow(true); } - while (gridBounds.right < bounds.right) { + while (this.getGridBounds().right < bounds.right) { this.insertColumn(false); } } }, getGridBounds:function() { - if (!this.grid) return null; var topLeftTile = this.grid[0][0]; var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1]; return new OpenLayers.Bounds(topLeftTile.bounds.left,