Change to getZoomForResolution() (and those who call it) so that it does not choose the closest fit by default. Doing so was causing us problems, because user would drag a zoom box and then the map's new zoom would not contain said zoombox. Not good. Default is back to how it was before, but now there's an option 'closest' for those times when what we really want is the closest. Right now, the only time that's true is when we're switching baselayers. This is based on the work from sandbox/euzuro/zoomToResolution, which is started by reverting r4318. (Closes #1043)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4792 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -78,27 +78,13 @@
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125,
|
||||
* 0.000021457672119140625]
|
||||
*
|
||||
* So, we expect a zoom of 8 because it is the closest resolution.
|
||||
*/
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
|
||||
t.eq( zoom, 7, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 2 because it is the closest.
|
||||
*/
|
||||
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
t.eq( zoom, 1, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user