Pullup fix for zooms to branch. (Closes #1043) 4791:4792

git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4795 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-10-03 20:42:35 +00:00
parent 6ecd34eaf0
commit c505d23c7b
9 changed files with 85 additions and 121 deletions

View File

@@ -707,7 +707,7 @@ OpenLayers.Map = OpenLayers.Class({
} else {
// zoom to oldExtent *and* force zoom change
this.setCenter(oldExtent.getCenterLonLat(),
this.getZoomForExtent(oldExtent),
this.getZoomForExtent(oldExtent, true),
false, true);
}
}
@@ -1356,15 +1356,19 @@ OpenLayers.Map = OpenLayers.Class({
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* closest - {Boolean} Find the zoom level that most closely fits the
* specified bounds. Note that this may result in a zoom that does
* not exactly contain the entire extent.
* Default is false.
*
* Returns:
* {Integer} A suitable zoom level for the specified bounds.
* If no baselayer is set, returns null.
*/
getZoomForExtent: function (bounds) {
getZoomForExtent: function (bounds, closest) {
var zoom = null;
if (this.baseLayer != null) {
zoom = this.baseLayer.getZoomForExtent(bounds);
zoom = this.baseLayer.getZoomForExtent(bounds, closest);
}
return zoom;
},
@@ -1374,15 +1378,22 @@ OpenLayers.Map = OpenLayers.Class({
*
* Parameter:
* resolution - {Float}
* closest - {Boolean} Find the zoom level that corresponds to the absolute
* closest resolution, which may result in a zoom whose corresponding
* resolution is actually smaller than we would have desired (if this
* is being called from a getZoomForExtent() call, then this means that
* the returned zoom index might not actually contain the entire
* extent specified... but it'll be close).
* Default is false.
*
* Returns:
* {Integer} A suitable zoom level for the specified resolution.
* If no baselayer is set, returns null.
*/
getZoomForResolution: function(resolution) {
getZoomForResolution: function(resolution, closest) {
var zoom = null;
if (this.baseLayer != null) {
zoom = this.baseLayer.getZoomForResolution(resolution);
zoom = this.baseLayer.getZoomForResolution(resolution, closest);
}
return zoom;
},