diff --git a/html/static/js/map-locator.js b/html/static/js/map-locator.js index c612077e..a448ed62 100644 --- a/html/static/js/map-locator.js +++ b/html/static/js/map-locator.js @@ -57,7 +57,7 @@ class MapLocator extends HTMLElement { */ 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: { @@ -65,6 +65,13 @@ class MapLocator extends HTMLElement { } }); }); + this._map.on("zoomend", (e) => { + this.dispatchEvent(new CustomEvent("zoomend"), { + bubbles: true, + composed: true, + detail: e, + }); + }); } // Initial render of component @@ -100,6 +107,10 @@ class MapLocator extends HTMLElement { `; } + GetZoom() { + return this._map.getZoom(); + } + JumpTo(args) { this._map.jumpTo(args); } diff --git a/rmo/template/nuisance.html b/rmo/template/nuisance.html index 71352038..a1f82ada 100644 --- a/rmo/template/nuisance.html +++ b/rmo/template/nuisance.html @@ -124,7 +124,7 @@ document.addEventListener('DOMContentLoaded', function() { }) let mapZoom = document.getElementById('map-zoom'); mapLocator.addEventListener("zoomend", function(e) { - mapZoom.value = e.target.getZoom(); + mapZoom.value = e.target.GetZoom(); }); mapLocator.addEventListener("markerdragend", (e) => { const marker = event.detail.marker;