incorporate @ahocevar's review

This commit is contained in:
Bart van den Eijnden
2013-01-04 17:05:03 +01:00
parent 1e1ce54e5b
commit de4b995616

View File

@@ -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);
}
},