From 250a3cbf58e94aaade3c9439ea1edcc829a5a248 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 30 Jan 2026 22:13:22 +0000 Subject: [PATCH] Wire up the zoom on the map --- html/static/js/map-locator.js | 13 ++++++++++++- rmo/template/nuisance.html | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) 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;