diff --git a/externs/olx.js b/externs/olx.js index ea8cc2fb2e..4f1d6f5f07 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5598,7 +5598,6 @@ olx.source.TileJSONOptions.prototype.wrapX; * hidpi: (boolean|undefined), * logo: (string|olx.LogoOptions|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), - * maxZoom: (number|undefined), * projection: ol.ProjectionLike, * reprojectionErrorThreshold: (number|undefined), * serverType: (ol.source.wms.ServerType|string|undefined), @@ -5692,14 +5691,6 @@ olx.source.TileWMSOptions.prototype.logo; olx.source.TileWMSOptions.prototype.tileGrid; -/** - * Maximum zoom. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.maxZoom; - - /** * Projection. * @type {ol.ProjectionLike} @@ -5903,7 +5894,6 @@ olx.source.VectorOptions.prototype.wrapX; * matrixSet: string, * dimensions: (!Object|undefined), * url: (string|undefined), - * maxZoom: (number|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined), * urls: (Array.|undefined), * tileClass: (function(new: ol.ImageTile, ol.TileCoord, @@ -6064,14 +6054,6 @@ olx.source.WMTSOptions.prototype.dimensions; olx.source.WMTSOptions.prototype.url; -/** - * Maximum zoom. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.maxZoom; - - /** * Optional function to load a tile given a URL. The default is * ```js diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index 13c2635576..ba70a0af1f 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -105,8 +105,8 @@ ol.source.Stamen = function(options) { attributions: ol.source.Stamen.ATTRIBUTIONS, cacheSize: options.cacheSize, crossOrigin: 'anonymous', - maxZoom: providerConfig.maxZoom, - minZoom: providerConfig.minZoom, + maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom, + minZoom: options.minZoom != undefined ? options.minZoom : providerConfig.minZoom, opaque: layerConfig.opaque, reprojectionErrorThreshold: options.reprojectionErrorThreshold, tileLoadFunction: options.tileLoadFunction, diff --git a/test/spec/ol/source/stamensource.test.js b/test/spec/ol/source/stamensource.test.js new file mode 100644 index 0000000000..189d16b139 --- /dev/null +++ b/test/spec/ol/source/stamensource.test.js @@ -0,0 +1,28 @@ +goog.provide('ol.test.source.Stamen'); + +describe('ol.source.Stamen', function() { + + describe('constructor', function() { + + it('can be constructed with a custom minZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + minZoom: 10 + }); + expect(source.getTileGrid().getMinZoom()).to.be(10); + }); + + it('can be constructed with a custom maxZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + maxZoom: 8 + }); + expect(source.getTileGrid().getMaxZoom()).to.be(8); + + }); + + }); + +}); + +goog.require('ol.source.Stamen');