mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-02-06 00:13:09 +00:00
add try catch to setTerrain
This commit is contained in:
@@ -212,16 +212,21 @@ export class MapboxGLMap {
|
|||||||
const map = get(this._map);
|
const map = get(this._map);
|
||||||
if (map) {
|
if (map) {
|
||||||
const source = get(terrainSource);
|
const source = get(terrainSource);
|
||||||
if (!map.getSource(source)) {
|
try {
|
||||||
map.addSource(source, terrainSources[source]);
|
if (!map.getSource(source)) {
|
||||||
}
|
map.addSource(source, terrainSources[source]);
|
||||||
if (map.getPitch() > 0) {
|
}
|
||||||
map.setTerrain({
|
if (map.getPitch() > 0) {
|
||||||
source: source,
|
map.setTerrain({
|
||||||
exaggeration: 1,
|
source: source,
|
||||||
});
|
exaggeration: 1,
|
||||||
} else {
|
});
|
||||||
map.setTerrain(null);
|
} else {
|
||||||
|
map.setTerrain(null);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// No reliable way to check if the map is ready to add sources and layers
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user