diff --git a/assets/js/weather_map_hook.ts b/assets/js/weather_map_hook.ts index dc05f2bc..993c3a6a 100644 --- a/assets/js/weather_map_hook.ts +++ b/assets/js/weather_map_hook.ts @@ -637,9 +637,7 @@ function buildDetailHTML(point: WeatherPoint): string { ] const mobile = isMobile() - const closeBtn = mobile - ? `` - : "" + const closeBtn = `` const handle = mobile ? `
` : "" @@ -737,6 +735,15 @@ export const WeatherMap: WeatherMapHook = { if (this.detailPanel) { L.DomEvent.disableClickPropagation(this.detailPanel) L.DomEvent.disableScrollPropagation(this.detailPanel) + + this.detailPanel.addEventListener("click", (e: MouseEvent) => { + if ((e.target as HTMLElement).closest(".detail-close-btn") && this.detailPanel) { + this.detailPanel.style.display = "none" + this.detailPanel.innerHTML = "" + this.clickMarker?.clearLayers() + if (this.escHint) this.escHint.style.opacity = "0" + } + }) } // ESC hint