Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only stop "preclick" on popup open for markers #4788

Merged
merged 1 commit into from
Aug 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Only stop "preclick" on popup open for markers
We actually do not toggle the popup on click for L.Path.
  • Loading branch information
yohanboniface committed Aug 2, 2016
commit 6789fa1e1795bc5a585e7e877bed080c06ba98fe
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