Wire up the zoom on the map

This commit is contained in:
Eli Ribble 2026-01-30 22:13:22 +00:00
parent f0fcfe548e
commit 250a3cbf58
No known key found for this signature in database
2 changed files with 13 additions and 2 deletions

View file

@ -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);
}