rearranging the style here for setBaseLayer() so that it's more readable, less duplication of code. No functional change, all tests pass

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4800 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-10-03 22:32:01 +00:00
parent 5904d15680
commit 145e446ceb

View File

@@ -707,19 +707,21 @@ OpenLayers.Map = OpenLayers.Class({
//redraw all layers //redraw all layers
var center = this.getCenter(); var center = this.getCenter();
if (center != null) { if (center != null) {
if (oldExtent == null) {
// simply set center but force zoom change //either get the center from the old Extent or just from
this.setCenter( // the current center of the map.
center, var newCenter = (oldExtent)
this.getZoomForResolution(this.resolution, true), ? oldExtent.getCenterLonLat()
false, true : center;
);
} else { //the new zoom will either come from the old Extent or
// zoom to oldExtent *and* force zoom change // from the current resolution of the map
this.setCenter(oldExtent.getCenterLonLat(), var newZoom = (oldExtent)
this.getZoomForExtent(oldExtent, true), ? this.getZoomForExtent(oldExtent, true)
false, true); : this.getZoomForResolution(this.resolution, true);
}
// zoom and force zoom change
this.setCenter(newCenter, newZoom, false, true);
} }
this.events.triggerEvent("changebaselayer"); this.events.triggerEvent("changebaselayer");