[Pkg-javascript-commits] [leaflet] 56/301: Use this._popupHandlersAdded to manage Marker popup event

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:41 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 c7eac791b22a1ebd6ac5c48f64c0ee6905d3fb2b
Author: Yohan Boniface <yb at enix.org>
Date:   Thu Aug 15 00:16:58 2013 +0200

    Use this._popupHandlersAdded to manage Marker popup event
    
    Just like it's done in Path. This allows to cut event management on bindPopup
---
 src/layer/marker/Marker.Popup.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/layer/marker/Marker.Popup.js b/src/layer/marker/Marker.Popup.js
index e62cdee..5463f30 100644
--- a/src/layer/marker/Marker.Popup.js
+++ b/src/layer/marker/Marker.Popup.js
@@ -41,11 +41,12 @@ L.Marker.include({
 
 		options = L.extend({offset: anchor}, options);
 
-		if (!this._popup) {
+		if (!this._popupHandlersAdded) {
 			this
 			    .on('click', this.togglePopup, this)
 			    .on('remove', this.closePopup, this)
 			    .on('move', this._movePopup, this);
+			this._popupHandlersAdded = true;
 		}
 
 		if (content instanceof L.Popup) {
@@ -70,9 +71,10 @@ L.Marker.include({
 		if (this._popup) {
 			this._popup = null;
 			this
-			    .off('click', this.togglePopup)
-			    .off('remove', this.closePopup)
-			    .off('move', this._movePopup);
+			    .off('click', this.togglePopup, this)
+			    .off('remove', this.closePopup, this)
+			    .off('move', this._movePopup, this);
+			this._popupHandlersAdded = false;
 		}
 		return this;
 	},

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