Support minZoom in ol.source.Stamen

This commit is contained in:
Frederic Junod
2016-03-23 12:39:39 +01:00
parent cc9d4d8794
commit 548e4abd35
4 changed files with 11 additions and 4 deletions

View File

@@ -6128,7 +6128,7 @@ olx.source.XYZOptions.prototype.maxZoom;
/** /**
* Unsupported (TODO: remove this). * Optional min zoom level. Default is `0`.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */

View File

@@ -70,7 +70,7 @@ ol.source.StamenProviderConfig = {
maxZoom: 20 maxZoom: 20
}, },
'watercolor': { 'watercolor': {
minZoom: 3, minZoom: 1,
maxZoom: 16 maxZoom: 16
} }
}; };
@@ -106,8 +106,7 @@ ol.source.Stamen = function(options) {
cacheSize: options.cacheSize, cacheSize: options.cacheSize,
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
maxZoom: providerConfig.maxZoom, maxZoom: providerConfig.maxZoom,
// FIXME uncomment the following when tilegrid supports minZoom minZoom: providerConfig.minZoom,
//minZoom: providerConfig.minZoom,
opaque: layerConfig.opaque, opaque: layerConfig.opaque,
reprojectionErrorThreshold: options.reprojectionErrorThreshold, reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,

View File

@@ -33,6 +33,7 @@ ol.source.XYZ = function(options) {
ol.tilegrid.createXYZ({ ol.tilegrid.createXYZ({
extent: ol.tilegrid.extentFromProjection(projection), extent: ol.tilegrid.extentFromProjection(projection),
maxZoom: options.maxZoom, maxZoom: options.maxZoom,
minZoom: options.minZoom,
tileSize: options.tileSize tileSize: options.tileSize
}); });

View File

@@ -20,6 +20,13 @@ describe('ol.source.XYZ', function() {
expect(tileSource.getTileGrid().getTileSize(0)).to.be(512); expect(tileSource.getTileGrid().getTileSize(0)).to.be(512);
}); });
it('can be constructed with a custom min zoom', function() {
var tileSource = new ol.source.XYZ({
minZoom: 2
});
expect(tileSource.getTileGrid().getMinZoom()).to.be(2);
});
}); });
describe('tileUrlFunction', function() { describe('tileUrlFunction', function() {