[Pkg-javascript-commits] [leaflet] 126/301: fix layers control not scrolling in FF, close #2029

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:46 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 1a3b150a2d140f46ae3578e770b607d9ec8c72eb
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date:   Mon Oct 14 13:29:17 2013 +0300

    fix layers control not scrolling in FF, close #2029
    
    and also add DomEvent disableScrollPropagation method
---
 src/control/Control.Layers.js |  5 +++--
 src/dom/DomEvent.js           | 14 +++++++++++---
 src/layer/Popup.js            |  5 +++--
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/control/Control.Layers.js b/src/control/Control.Layers.js
index 4a4d72b..c0bcf8e 100644
--- a/src/control/Control.Layers.js
+++ b/src/control/Control.Layers.js
@@ -69,8 +69,9 @@ L.Control.Layers = L.Control.extend({
 		container.setAttribute('aria-haspopup', true);
 
 		if (!L.Browser.touch) {
-			L.DomEvent.disableClickPropagation(container);
-			L.DomEvent.on(container, 'mousewheel', L.DomEvent.stopPropagation);
+			L.DomEvent
+				.disableClickPropagation(container)
+				.disableScrollPropagation(container);
 		} else {
 			L.DomEvent.on(container, 'click', L.DomEvent.stopPropagation);
 		}
diff --git a/src/dom/DomEvent.js b/src/dom/DomEvent.js
index fff44fa..ccad201 100644
--- a/src/dom/DomEvent.js
+++ b/src/dom/DomEvent.js
@@ -106,16 +106,24 @@ L.DomEvent = {
 		return this;
 	},
 
+	disableScrollPropagation: function (el) {
+		var stop = L.DomEvent.stopPropagation;
+
+		return L.DomEvent
+			.on(el, 'mousewheel', stop)
+			.on(el, 'MozMousePixelScroll', stop);
+	},
+
 	disableClickPropagation: function (el) {
 		var stop = L.DomEvent.stopPropagation;
 
 		for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
-			L.DomEvent.addListener(el, L.Draggable.START[i], stop);
+			L.DomEvent.on(el, L.Draggable.START[i], stop);
 		}
 
 		return L.DomEvent
-			.addListener(el, 'click', L.DomEvent._fakeStop)
-			.addListener(el, 'dblclick', stop);
+			.on(el, 'click', L.DomEvent._fakeStop)
+			.on(el, 'dblclick', stop);
 	},
 
 	preventDefault: function (e) {
diff --git a/src/layer/Popup.js b/src/layer/Popup.js
index 3137ac3..a7679b9 100644
--- a/src/layer/Popup.js
+++ b/src/layer/Popup.js
@@ -168,9 +168,10 @@ L.Popup = L.Class.extend({
 		L.DomEvent.disableClickPropagation(wrapper);
 
 		this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);
-		L.DomEvent.on(this._contentNode, 'mousewheel', L.DomEvent.stopPropagation);
-		L.DomEvent.on(this._contentNode, 'MozMousePixelScroll', L.DomEvent.stopPropagation);
+
+		L.DomEvent.disableScrollPropagation(this._contentNode);
 		L.DomEvent.on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);
+
 		this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
 		this._tip = L.DomUtil.create('div', prefix + '-tip', this._tipContainer);
 	},

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