[Pkg-javascript-commits] [leaflet] 148/301: Adding bounceAtZoomLimits option

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:47 UTC 2014


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

js pushed a commit to branch master
in repository leaflet.

commit 3b79dd816bba99fb9e29ae0686774363f5690b85
Author: Trevor Powell <trevor.w.powell at gmail.com>
Date:   Thu Oct 24 13:26:52 2013 -0500

    Adding bounceAtZoomLimits option
---
 src/map/handler/Map.TouchZoom.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/map/handler/Map.TouchZoom.js b/src/map/handler/Map.TouchZoom.js
index 57f1b37..5671bc6 100644
--- a/src/map/handler/Map.TouchZoom.js
+++ b/src/map/handler/Map.TouchZoom.js
@@ -3,7 +3,8 @@
  */
 
 L.Map.mergeOptions({
-	touchZoom: L.Browser.touch && !L.Browser.android23
+	touchZoom: L.Browser.touch && !L.Browser.android23,
+	bounceAtZoomLimits: true
 });
 
 L.Map.TouchZoom = L.Handler.extend({
@@ -54,9 +55,11 @@ L.Map.TouchZoom = L.Handler.extend({
 		this._scale = p1.distanceTo(p2) / this._startDist;
 		this._delta = p1._add(p2)._divideBy(2)._subtract(this._startCenter);
 
-		if (this._scale === 1 ||
-		    (map.getZoom() === map.getMinZoom() && this._scale < 1) ||
-		    (map.getZoom() === map.getMaxZoom() && this._scale > 1)) { return; }
+		if (this._scale === 1) { return; }
+
+		if (!map.options.bounceAtZoomLimits) {
+			if ((map.getZoom() === map.getMinZoom() && this._scale < 1) || (map.getZoom() === map.getMaxZoom() && this._scale > 1)) { return; }
+		}
 
 		if (!this._moved) {
 			L.DomUtil.addClass(map._mapPane, 'leaflet-touching');

-- 
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