[Pkg-javascript-commits] [leaflet] 01/78: enforce maxZoom before applying paddingOffset, fixes #2489

Jonas Smedegaard dr at jones.dk
Sat May 7 08:58:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit 2812151bac3e7b80b294d23d88589c12128d792a
Author: Brian Stoner <bsstoner at gmail.com>
Date:   Wed Feb 26 17:21:49 2014 -0500

    enforce maxZoom before applying paddingOffset, fixes #2489
---
 src/map/Map.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/map/Map.js b/src/map/Map.js
index 059a928..2aa2418 100644
--- a/src/map/Map.js
+++ b/src/map/Map.js
@@ -96,15 +96,16 @@ L.Map = L.Class.extend({
 		var paddingTL = L.point(options.paddingTopLeft || options.padding || [0, 0]),
 		    paddingBR = L.point(options.paddingBottomRight || options.padding || [0, 0]),
 
-		    zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)),
-		    paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
+		    zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
+
+		zoom = (options.maxZoom) ? Math.min(options.maxZoom, zoom) : zoom;
+
+		var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
 
 		    swPoint = this.project(bounds.getSouthWest(), zoom),
 		    nePoint = this.project(bounds.getNorthEast(), zoom),
 		    center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
 
-		zoom = options && options.maxZoom ? Math.min(options.maxZoom, zoom) : zoom;
-
 		return this.setView(center, zoom, options);
 	},
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list