fix popup autoclose, fixes #40

This commit is contained in:
mourner 2011-04-27 14:06:47 +03:00
parent c2102d5402
commit 6ce60cadc7
2 changed files with 3 additions and 1 deletions

View File

@ -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();

View File

@ -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),