From e61545167d8b164f83f253354972c2a23dd72f39 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 24 Aug 2006 14:08:18 +0000 Subject: [PATCH] Map should change zoom level to maximum for the baseLayer when the baseLayer changes, rather than trying to set it to 17, which will fail, and leave the zoom level as null, and then everything explodes. Thanks to Heidi Fox at MC for this report. git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1355 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index d1dec79ebe..0cba536751 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -371,9 +371,12 @@ OpenLayers.Map.prototype = { if (center != null) { var zoom = this.getZoom(); this.zoom = null; + if (zoom > this.baseLayer.numZoomLevels - 1) { + zoom = this.baseLayer.numZoomLevels - 1; + } this.setCenter(center, zoom); + } - if ((noEvent == null) || (noEvent == false)) { this.events.triggerEvent("changebaselayer"); } @@ -562,7 +565,6 @@ OpenLayers.Map.prototype = { * trigger movestart/end events */ setCenter: function (lonlat, zoom, minor) { - var zoomChanged = (this.isValidZoomLevel(zoom)) && (zoom != this.getZoom()); @@ -599,7 +601,7 @@ OpenLayers.Map.prototype = { this.popups[i].updatePosition(); } } - + //send the move call to the baselayer and all the overlays var bounds = this.getExtent(); for (var i = 0; i < this.layers.length; i++) {