From 7b62f33544c1f3547982b9f6b743d90e3d0b15a2 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 13 May 2006 15:25:28 +0000 Subject: [PATCH] More zoom level bounds checking. git-svn-id: http://svn.openlayers.org/trunk/openlayers@28 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 9816f14b4b..767da7b8a8 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -225,7 +225,7 @@ OpenLayers.Map.prototype = { this.zoom = zoom; } - this.moveToNewExtent(); + this.moveToNewExtent(zoomChanged); }, moveToNewExtent: function (zoomChanged) { @@ -244,7 +244,7 @@ OpenLayers.Map.prototype = { * Increase zoom level by one. */ zoomIn: function() { - if (this.zoom != null) { + if (this.zoom != null && this.zoom <= this.getZoomLevels()) { this.zoom += 1; this.moveToNewExtent(true); } @@ -256,8 +256,10 @@ OpenLayers.Map.prototype = { * Set Zoom To int */ zoomTo: function(zoom) { + if (zoom >= 0 && zoom <= this.getZoomLevels()) { this.zoom = zoom; this.moveToNewExtent(true); + } }, /**