From 9f608067fcfe6006ba85fd39ab657e229990eb14 Mon Sep 17 00:00:00 2001 From: Zias van Nes Date: Sat, 22 Nov 2025 19:47:59 +0100 Subject: [PATCH] fix:dont autozoom when watching --- src/lib/components/map/Map.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/map/Map.svelte b/src/lib/components/map/Map.svelte index eacef28..db0f1b2 100644 --- a/src/lib/components/map/Map.svelte +++ b/src/lib/components/map/Map.svelte @@ -87,8 +87,10 @@ const mapReady = $derived(mapLoaded && styleLoaded && isIdle); // Reactive center and zoom based on location or props + // Only recenter when shouldZoomToLocation is true (user clicked location button) + // or when autoCenter is true AND coordinates are first loaded const mapCenter = $derived( - $coordinates && (autoCenter || $shouldZoomToLocation) + $coordinates && $shouldZoomToLocation ? ([$coordinates.longitude, $coordinates.latitude] as [number, number]) : center || $getMapCenter ); @@ -98,9 +100,7 @@ // Force zoom to calculated level when location button is clicked return $getMapZoom; } - if ($coordinates && autoCenter) { - return $getMapZoom; - } + // Don't auto-zoom on coordinate updates, keep current zoom return zoom || 13; });