From 6ce60cadc7bf1de2d3fceb58fe4a93347c4eb0de Mon Sep 17 00:00:00 2001 From: mourner Date: Wed, 27 Apr 2011 14:06:47 +0300 Subject: [PATCH] fix popup autoclose, fixes #40 --- src/layer/Popup.js | 2 +- src/map/Map.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/layer/Popup.js b/src/layer/Popup.js index 834a1e66..190cab87 100644 --- a/src/layer/Popup.js +++ b/src/layer/Popup.js @@ -27,7 +27,7 @@ L.Popup = L.Class.extend({ this._map._panes.popupPane.appendChild(this._container); this._map.on('viewreset', this._updatePosition, this); if (this._map.options.closePopupOnClick) { - this._map.on('click', this._close, this); + this._map.on('preclick', this._close, this); } this._update(); diff --git a/src/map/Map.js b/src/map/Map.js index 6e065101..a1382af7 100644 --- a/src/map/Map.js +++ b/src/map/Map.js @@ -399,10 +399,12 @@ L.Map = L.Class.extend({ _onMouseClick: function(e) { if (this.dragging && this.dragging.moved()) { return; } + this._fireMouseEvent(e); }, _fireMouseEvent: function(e) { + this.fire('pre' + e.type); if (!this.hasEventListeners(e.type)) { return; } this.fire(e.type, { latlng: this.mouseEventToLatLng(e),