fix: disable map fly animation when switching between assets (#19223)

This commit is contained in:
Zack Pollard 2025-06-17 12:45:48 +01:00 committed by GitHub
parent 00536bf074
commit 864fe3d0d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,6 +74,8 @@
showSimpleControls = true,
}: Props = $props();
const initialCenter = center;
let map: maplibregl.Map | undefined = $state();
let marker: maplibregl.Marker | null = null;
let abortController: AbortController;
@ -247,6 +249,10 @@
},
});
});
$effect(() => {
map?.jumpTo({ center, zoom });
});
</script>
<!-- We handle style loading ourselves so we set style blank here -->
@ -254,8 +260,8 @@
{hash}
style=""
class="h-full {rounded ? 'rounded-2xl' : 'rounded-none'}"
{center}
{zoom}
center={initialCenter}
attributionControl={false}
diffStyleUpdates={true}
onload={(event) => {