From b5853b11249a3758a090dfc3c157f7ece52eaf0f Mon Sep 17 00:00:00 2001 From: Max Kohler Date: Thu, 11 Jun 2026 13:19:33 +0200 Subject: [PATCH 1/2] implement feature --- components/src/maplibre/Map/Map.svelte | 10 +++++----- .../maplibre/MapStyle/SWRDataLabDark.stories.svelte | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/src/maplibre/Map/Map.svelte b/components/src/maplibre/Map/Map.svelte index 2d48b733..4f48aa56 100644 --- a/components/src/maplibre/Map/Map.svelte +++ b/components/src/maplibre/Map/Map.svelte @@ -117,15 +117,15 @@ mapContext.map.on('load', () => { zoom = mapContext.map?.getZoom(); center = mapContext.map?.getCenter(); - pitch = mapContext.map?.getPitch(); - bearing = mapContext.map?.getBearing(); + pitch = mapContext.map?.getPitch() || 0; + bearing = mapContext.map?.getBearing() || 0; }); mapContext.map.on('moveend', () => { zoom = mapContext.map?.getZoom(); center = mapContext.map?.getCenter(); - pitch = mapContext.map?.getPitch(); - bearing = mapContext.map?.getBearing(); + pitch = mapContext.map?.getPitch() || 0; + bearing = mapContext.map?.getBearing() || 0; }); if (onmoveend) { @@ -178,7 +178,7 @@ } }); - const debugValues = $derived(Object.entries({ zoom, pitch, allowZoom, allowPan, allowRotation })); + const debugValues = $derived(Object.entries({ zoom, pitch, bearing, allowZoom, allowPan, allowRotation })); const handleDebugValueClick = (e: MouseEvent) => { if (e.target) { const t = e.target as HTMLElement; diff --git a/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte b/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte index d325fc6d..05013937 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte +++ b/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte @@ -23,7 +23,7 @@ - + From 84a31c5ad5429d5eeb0f1b387f41ccf8f4496ed9 Mon Sep 17 00:00:00 2001 From: Max Kohler Date: Thu, 11 Jun 2026 13:21:22 +0200 Subject: [PATCH 2/2] Include bearing in copied location --- components/src/maplibre/Map/Map.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/src/maplibre/Map/Map.svelte b/components/src/maplibre/Map/Map.svelte index 4f48aa56..24a4cd75 100644 --- a/components/src/maplibre/Map/Map.svelte +++ b/components/src/maplibre/Map/Map.svelte @@ -188,7 +188,7 @@ }; const handleDebugCopyLocationClick = (e: MouseEvent) => { if (e.target) { - const s = JSON.stringify({ lng: center?.lng, lat: center?.lat, zoom, pitch }); + const s = JSON.stringify({ lng: center?.lng, lat: center?.lat, zoom, pitch, bearing }); navigator.clipboard.writeText(s); } };