Use OSM resolutions as fallback resolutions.

Hat tip to @twpayne for suggesting this change in the defaults.
This commit is contained in:
Marc Jansen
2013-03-12 16:08:18 +01:00
parent f496471273
commit ce67625b20
2 changed files with 12 additions and 7 deletions

View File

@@ -123,20 +123,22 @@ ol.control.ZoomSlider.CSS_CLASS_THUMB =
/**
* 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}
*/
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
* an explicit value.
* an explicit value. The default value is the resolution of the standard OSM
* tiles at zoomlevel 0.
*
* @const {number}
*/
ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION = 1000000;
ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION = 156543.0339;
/**

View File

@@ -22,12 +22,15 @@ describe('ol.control.ZoomSlider', function() {
describe('configuration & defaults', function() {
it('has valid defaults for min and maxresolution', function() {
var expectedMin = 0.5971642833948135,
expectedMax = 156543.0339,
expectedRange = expectedMax - expectedMin;
expect(function() {
zoomslider = new ol.control.ZoomSlider({});
}).not.toThrow();
expect(zoomslider.minResolution_).toBe(500);
expect(zoomslider.maxResolution_).toBe(1000000);
expect(zoomslider.range_).toBe(999500);
expect(zoomslider.minResolution_).toBe(expectedMin);
expect(zoomslider.maxResolution_).toBe(expectedMax);
expect(zoomslider.range_).toBe(expectedRange);
});
it('throws exception when configured with wrong resolutions', function() {