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); + } }, /**