From 48f0e7e2ec3eb62a9f7d72ae2250449c6a57bf37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sun, 14 Apr 2013 22:12:12 +0200 Subject: [PATCH] More View2D configuration flexibility --- src/ol/view2d.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ol/view2d.js b/src/ol/view2d.js index 035ac3120c..c7b2fc6df2 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -391,20 +391,20 @@ ol.View2D.createResolutionConstraint_ = function(options) { resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions( resolutions); } else { - var maxZoom, zoomFactor; - if (goog.isDef(options.maxResolution) && - goog.isDef(options.maxZoom) && - goog.isDef(options.zoomFactor)) { - maxResolution = options.maxResolution; - maxZoom = options.maxZoom; - zoomFactor = options.zoomFactor; - } else { + maxResolution = options.maxResolution; + if (!goog.isDef(maxResolution)) { var projectionExtent = ol.projection.createProjection( options.projection, 'EPSG:3857').getExtent(); maxResolution = Math.max( projectionExtent.maxX - projectionExtent.minX, projectionExtent.maxY - projectionExtent.minY) / ol.DEFAULT_TILE_SIZE; + } + var maxZoom = options.maxZoom; + if (!goog.isDef(maxZoom)) { maxZoom = 28; + } + var zoomFactor = options.zoomFactor; + if (!goog.isDef(zoomFactor)) { zoomFactor = 2; } minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);