diff --git a/html/static/js/map-locator.js b/html/static/js/map-locator.js index a448ed62..ab10e65a 100644 --- a/html/static/js/map-locator.js +++ b/html/static/js/map-locator.js @@ -1,4 +1,3 @@ -var map = null; // A map that can be used to locate a single point by setting its location explicitly // or by allowing the user to move a marker. class MapLocator extends HTMLElement { @@ -55,22 +54,33 @@ class MapLocator extends HTMLElement { })); map.addControl(new mapboxgl.NavigationControl()); */ + this._map.on("click", (e) => { + e.preventDefault(); + console.log("internal click", e); + this.dispatchEvent(new CustomEvent("click", { + bubbles: true, + composed: true, // Allows event to cross shadow DOM boundary + detail: { + lngLat: e.lngLat, + }, + })); + }); this._map.on("load", () => { console.log("map loaded"); - this.dispatchEvent(new CustomEvent("load"), { + this.dispatchEvent(new CustomEvent("load", { bubbles: true, composed: true, // Allows event to cross shadow DOM boundary detail: { map: this } - }); + })); }); this._map.on("zoomend", (e) => { - this.dispatchEvent(new CustomEvent("zoomend"), { + this.dispatchEvent(new CustomEvent("zoomend", { bubbles: true, composed: true, detail: e, - }); + })); }); } diff --git a/rmo/template/nuisance.html b/rmo/template/nuisance.html index 47839138..10720db9 100644 --- a/rmo/template/nuisance.html +++ b/rmo/template/nuisance.html @@ -10,6 +10,19 @@