mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 22:57:32 +00:00
fix(ferratas): leaving 3D with via ferratas on no longer crashes, the removed map is not asked for its layers
This commit is contained in:
@@ -136,6 +136,9 @@ function addFerrataIcon(map: Map, paint: FerrataPaint, gone: () => boolean): voi
|
||||
}
|
||||
|
||||
function removeFerrataLayers(map: Map): void {
|
||||
// A map already removed with its view (leaving 3D) took its style and the layers with it;
|
||||
// asking it for a layer then throws.
|
||||
if (!map.getStyle?.()) return;
|
||||
for (const layer of [...LAYERS].reverse()) if (map.getLayer(layer)) map.removeLayer(layer);
|
||||
for (const source of [LABEL_SOURCE, SOURCE]) if (map.getSource(source)) map.removeSource(source);
|
||||
if (map.hasImage(FERRATA_ICON_IMAGE)) map.removeImage(FERRATA_ICON_IMAGE);
|
||||
|
||||
Reference in New Issue
Block a user