From 836c17f2e8451e220275c5f0be416b8e95e42a41 Mon Sep 17 00:00:00 2001 From: Joachim Schleicher Date: Tue, 10 Oct 2023 10:01:16 +0200 Subject: [PATCH] fire events from Popup Panel to also highlight path and markers when using the side panel. Therefore we duplicate the event code from the base class. --- umap/static/umap/js/umap.popup.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/umap/static/umap/js/umap.popup.js b/umap/static/umap/js/umap.popup.js index 9fd96b3c..d5836d3e 100644 --- a/umap/static/umap/js/umap.popup.js +++ b/umap/static/umap/js/umap.popup.js @@ -68,10 +68,28 @@ L.U.Popup.Panel = L.U.Popup.extend({ data: { html: this._content }, actions: [this.allButton()], }) + + // fire events as in base class Popup.js:onAdd + map.fire('popupopen', {popup: this}) + if (this._source) { + this._source.fire('popupopen', {popup: this}, true); + if (!(this._source instanceof L.Path)) { + this._source.on('preclick', L.DomEvent.stopPropagation); + } + } }, onRemove: function (map) { map.ui.closePanel() + + // fire events as in base class Popup.js:onRemove + map.fire('popupclose', {popup: this}); + if (this._source) { + this._source.fire('popupclose', {popup: this}, true); + if (!(this._source instanceof L.Path)) { + this._source.off('preclick', L.DomEvent.stopPropagation); + } + } }, update: function () {},