Use minZoom and maxZoom olx.source.StamenOptions

This commit is contained in:
Frederic Junod
2016-06-08 08:32:13 +02:00
parent 93a98337d8
commit 1b662ff048
2 changed files with 30 additions and 2 deletions

View File

@@ -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,

View File

@@ -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');