From ed85178d92887f21103350dfe3f11800297799bc Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 18 Feb 2015 19:59:27 +0100 Subject: [PATCH] Prevent the map from zooming out further than minZoomLevel if it is defined on the base layer --- lib/OpenLayers/Map.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3c11553289..50c5467079 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -2462,7 +2462,13 @@ OpenLayers.Map = OpenLayers.Class({ if (this.zoomTween) { this.zoomTween.stop(); } - this.zoomTo(this.getZoom() - 1); + if (this.baseLayer.minZoomLevel !== undefined) { + if (this.getZoom() > this.baseLayer.minZoomLevel) { + this.zoomTo(this.getZoom() - 1); + } + } else { + this.zoomTo(this.getZoom() - 1); + } }, /**