Fix: don't set invalid coordinates
This commit is contained in:
parent
fe9afb415f
commit
fbc3bce510
1 changed files with 5 additions and 1 deletions
|
@ -353,9 +353,13 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
||||||
|
|
||||||
const center = map.getCenter()
|
const center = map.getCenter()
|
||||||
if (center.lng !== loc.lon || center.lat !== loc.lat) {
|
if (center.lng !== loc.lon || center.lat !== loc.lat) {
|
||||||
|
if (isNaN(loc.lon) || isNaN(loc.lat)) {
|
||||||
|
console.error("Got invalid lat or lon, not setting")
|
||||||
|
} else {
|
||||||
map.setCenter({ lng: loc.lon, lat: loc.lat })
|
map.setCenter({ lng: loc.lon, lat: loc.lat })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async awaitStyleIsLoaded(): Promise<void> {
|
private async awaitStyleIsLoaded(): Promise<void> {
|
||||||
const map = this._maplibreMap.data
|
const map = this._maplibreMap.data
|
||||||
|
|
Loading…
Reference in a new issue