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