From 894263e5c45adc3ec6afeb00af8618b70b0436a4 Mon Sep 17 00:00:00 2001 From: Peter Meier Date: Thu, 4 Jun 2026 13:17:15 +0200 Subject: [PATCH] fix: OrganisationsMap erst bei Klick interaktiv, kein Page-Scroll-Hijack Initial Drag/Zoom deaktiviert. Overlay 'Karte aktivieren' freigibt Interaktion. Marker-Klick aktiviert automatisch mit. Co-Authored-By: Claude Sonnet 4.6 --- scripts/generate-icons.mjs | 2 ++ .../blocks/OrganisationsMapBlock.svelte | 33 ++++++++++++++++++- src/lib/iconify-mdi-subset.generated.json | 9 +++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/scripts/generate-icons.mjs b/scripts/generate-icons.mjs index 1f6be58..987626b 100644 --- a/scripts/generate-icons.mjs +++ b/scripts/generate-icons.mjs @@ -65,6 +65,8 @@ const EXTRA_ICONS = [ 'tag-outline', 'flag-outline', 'information-outline', + // OrganisationsMapBlock: activate-overlay + 'cursor-default-click-outline', ]; const STATIC_PATTERN = /icon="mdi:([a-z0-9-]+)"/g; diff --git a/src/lib/components/blocks/OrganisationsMapBlock.svelte b/src/lib/components/blocks/OrganisationsMapBlock.svelte index 29b8643..b73bd5a 100644 --- a/src/lib/components/blocks/OrganisationsMapBlock.svelte +++ b/src/lib/components/blocks/OrganisationsMapBlock.svelte @@ -24,9 +24,19 @@ let mapEl: HTMLDivElement; let map: import("leaflet").Map | null = null; let selectedOrg = $state(null); + let mapActive = $state(false); // Keep reference to highlight active marker let activeMarker: import("leaflet").CircleMarker | null = null; + function activateMap() { + if (mapActive || !map) return; + mapActive = true; + map.scrollWheelZoom.enable(); + map.dragging.enable(); + map.touchZoom.enable(); + map.doubleClickZoom.enable(); + } + const descriptionHtml = $derived( selectedOrg?.description ? (marked.parse(selectedOrg.description) as string) @@ -60,7 +70,13 @@ onMount(async () => { const L = (await import("leaflet")).default; - map = L.map(mapEl, { zoomControl: true }); + map = L.map(mapEl, { + zoomControl: true, + scrollWheelZoom: false, + dragging: false, + touchZoom: false, + doubleClickZoom: false, + }); L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { attribution: '© OpenStreetMap', @@ -85,6 +101,7 @@ }) .addTo(map!) .on("click", () => { + activateMap(); if (activeMarker && activeMarker !== marker) { activeMarker.setStyle({ fillColor: "#3d6b4f", radius: 8 }); } @@ -119,6 +136,20 @@
+ {#if !mapActive} + + {/if} + {#if selectedOrg}
" }, + "cursor-default-click-outline": { + "body": "" + }, + "phone": { + "body": "" + }, "clock-alert-outline": { "body": "" }, @@ -228,9 +234,6 @@ "email": { "body": "" }, - "phone": { - "body": "" - }, "telegram": { "body": "", "hidden": true