Make communication map location reactive

Prevents stateful errors like failing to update bounds when the API
fetches a new value for a report
This commit is contained in:
Eli Ribble 2026-04-28 20:31:40 +00:00
parent 2911c7b215
commit 4fcb184286
No known key found for this signature in database
3 changed files with 79 additions and 48 deletions

View file

@ -9,6 +9,13 @@ export function boundsDefault(): maplibregl.LngLatBounds {
);
}
export function boundsForServiceArea(b?: Bounds): maplibregl.LngLatBounds {
if (b) {
return boundsFromAPI(b);
} else {
return boundsDefault();
}
}
export function boundsFromAPI(b: Bounds): maplibregl.LngLatBounds {
return new maplibregl.LngLatBounds(
new maplibregl.LngLat(b.min.longitude, b.max.latitude),