Fix zoom in when we load existing report data

This commit is contained in:
Eli Ribble 2026-04-13 15:22:50 +00:00
parent b701771dfb
commit 0f94292ab7
No known key found for this signature in database

View file

@ -382,16 +382,26 @@ const frameMarkers = () => {
if (props.markers.length === 1) {
// Single marker: pan to it
// If we are zoomed way out we are likely in the default state antd therefore should zoom in a bunch
// for the framing.
const zoom = props.modelValue.zoom > 1 ? props.modelValue.zoom : 15;
console.log(
"framing single marker",
props.markers[0].location,
props.modelValue.zoom,
zoom,
);
map.value.panTo(
{
lat: props.markers[0].location.latitude,
lng: props.markers[0].location.longitude,
},
{ duration: 1000, zoom: props.modelValue.zoom },
{ duration: 1000, zoom: zoom },
{ isInternalUpdate: true },
);
} else {
// Multiple markers: fit bounds
console.log("framing multiple markers", props.markers);
const bounds = new maplibregl.LngLatBounds();
props.markers.forEach((marker) => {
bounds.extend([marker.location.longitude, marker.location.latitude]);
@ -409,6 +419,7 @@ watch(
() => props.modelValue,
(newCamera) => {
if (map.value && newCamera) {
console.log("panning based on model change", newCamera);
map.value.panTo(
{
lat: newCamera.location.latitude,