diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index d7b6adb2c1..5bd1e3be96 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -414,17 +414,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * changebaselayer event will be triggered. */ addOptions: function (newOptions, reinitialize) { + var singleTileChanged = newOptions.singleTile !== undefined && + newOptions.singleTile !== this.singleTile; OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments); - if (this.map && newOptions.singleTile !== undefined) { - this.initProperties(); - this.clearGrid(); - if (newOptions.singleTile === true) { + if (this.map && singleTileChanged) { + this.initProperties(); + this.tileSize = this.options.tileSize; this.setTileSize(); - this.initSingleTile(this.map.getExtent()); - } else { - this.tileSize = this.options.tileSize || this.map.getTileSize(); - this.initGriddedTiles(this.map.getExtent()); - } + this.moveTo(null, true); } },