Skip to content

Commit

Permalink
Only stop "preclick" on popup open for markers (#4788)
Browse files Browse the repository at this point in the history
We actually do not toggle the popup on click for L.Path.
  • Loading branch information
yohanboniface authored and mourner committed Aug 3, 2016
1 parent 3d2b92a commit c07f438
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/layer/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ L.Popup = L.DivOverlay.extend({
// @event popupopen: PopupEvent
// Fired when a popup bound to this layer is opened
this._source.fire('popupopen', {popup: this}, true);
this._source.on('preclick', L.DomEvent.stopPropagation);
// For non-path layers, we toggle the popup when clicking
// again the layer, so prevent the map to reopen it.
if (!(this._source instanceof L.Path)) {
this._source.on('preclick', L.DomEvent.stopPropagation);
}
}
},

Expand All @@ -121,7 +125,9 @@ L.Popup = L.DivOverlay.extend({
// @event popupclose: PopupEvent
// Fired when a popup bound to this layer is closed
this._source.fire('popupclose', {popup: this}, true);
this._source.off('preclick', L.DomEvent.stopPropagation);
if (!(this._source instanceof L.Path)) {
this._source.off('preclick', L.DomEvent.stopPropagation);
}
}
},

Expand Down

0 comments on commit c07f438

Please sign in to comment.