Use OSM resolutions as fallback resolutions.
Hat tip to @twpayne for suggesting this change in the defaults.
This commit is contained in:
@@ -123,20 +123,22 @@ ol.control.ZoomSlider.CSS_CLASS_THUMB =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The default value for minResolution_ when the control isn't instanciated with
|
* The default value for minResolution_ when the control isn't instanciated with
|
||||||
* an explicit value.
|
* an explicit value. The default value is the resolution of the standard OSM
|
||||||
|
* tiles at zoomlevel 18.
|
||||||
*
|
*
|
||||||
* @const {number}
|
* @const {number}
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.DEFAULT_MIN_RESOLUTION = 500;
|
ol.control.ZoomSlider.DEFAULT_MIN_RESOLUTION = 0.5971642833948135;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default value for maxResolution_ when the control isn't instanciated with
|
* The default value for maxResolution_ when the control isn't instanciated with
|
||||||
* an explicit value.
|
* an explicit value. The default value is the resolution of the standard OSM
|
||||||
|
* tiles at zoomlevel 0.
|
||||||
*
|
*
|
||||||
* @const {number}
|
* @const {number}
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION = 1000000;
|
ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION = 156543.0339;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ describe('ol.control.ZoomSlider', function() {
|
|||||||
describe('configuration & defaults', function() {
|
describe('configuration & defaults', function() {
|
||||||
|
|
||||||
it('has valid defaults for min and maxresolution', function() {
|
it('has valid defaults for min and maxresolution', function() {
|
||||||
|
var expectedMin = 0.5971642833948135,
|
||||||
|
expectedMax = 156543.0339,
|
||||||
|
expectedRange = expectedMax - expectedMin;
|
||||||
expect(function() {
|
expect(function() {
|
||||||
zoomslider = new ol.control.ZoomSlider({});
|
zoomslider = new ol.control.ZoomSlider({});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
expect(zoomslider.minResolution_).toBe(500);
|
expect(zoomslider.minResolution_).toBe(expectedMin);
|
||||||
expect(zoomslider.maxResolution_).toBe(1000000);
|
expect(zoomslider.maxResolution_).toBe(expectedMax);
|
||||||
expect(zoomslider.range_).toBe(999500);
|
expect(zoomslider.range_).toBe(expectedRange);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws exception when configured with wrong resolutions', function() {
|
it('throws exception when configured with wrong resolutions', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user