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
+6 -9
View File
@@ -414,17 +414,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* changebaselayer event will be triggered. * changebaselayer event will be triggered.
*/ */
addOptions: function (newOptions, reinitialize) { addOptions: function (newOptions, reinitialize) {
var singleTileChanged = newOptions.singleTile !== undefined &&
newOptions.singleTile !== this.singleTile;
OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments);
if (this.map && newOptions.singleTile !== undefined) { if (this.map && singleTileChanged) {
this.initProperties(); this.initProperties();
this.clearGrid(); this.tileSize = this.options.tileSize;
if (newOptions.singleTile === true) {
this.setTileSize(); this.setTileSize();
this.initSingleTile(this.map.getExtent()); this.moveTo(null, true);
} else {
this.tileSize = this.options.tileSize || this.map.getTileSize();
this.initGriddedTiles(this.map.getExtent());
}
} }
}, },