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:
parent
2911c7b215
commit
4fcb184286
3 changed files with 79 additions and 48 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue