diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index fecab71cda..b13af4afe2 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -55,19 +55,20 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { } if (!this.grid || zoomChanged) { this._initTiles(); - } - var i = 0; - while (this.getGridBounds().bottom > bounds.bottom) { - this.insertRow(false); - } - while (this.getGridBounds().left > bounds.left) { - this.insertColumn(true); - } - while (this.getGridBounds().top < bounds.top) { - this.insertRow(true); - } - while (this.getGridBounds().right < bounds.right) { - this.insertColumn(false); + } else { + var i = 0; + while (this.getGridBounds().bottom > bounds.bottom) { + this.insertRow(false); + } + while (this.getGridBounds().left > bounds.left) { + this.insertColumn(true); + } + while (this.getGridBounds().top < bounds.top) { + this.insertRow(true); + } + while (this.getGridBounds().right < bounds.right) { + this.insertColumn(false); + } } }, getGridBounds:function() {