fixes hidden trail after map style switch
This commit is contained in:
@@ -116,8 +116,6 @@
|
||||
|
||||
let hoveringTrail: boolean = false;
|
||||
|
||||
let loadedAfterStyleSwitch = false;
|
||||
|
||||
const trailColors = [
|
||||
"#3549BB",
|
||||
"#592E9E",
|
||||
@@ -938,7 +936,6 @@
|
||||
layers = {};
|
||||
map?.setStyle(style.value);
|
||||
localStorage.setItem("layer", style.text);
|
||||
loadedAfterStyleSwitch = true;
|
||||
},
|
||||
selectedIndex:
|
||||
preferredMapStyleIndex !== -1 ? preferredMapStyleIndex : 0,
|
||||
@@ -1046,17 +1043,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (loadedAfterStyleSwitch) {
|
||||
trails.forEach((t, i) => {
|
||||
const layerId = t.id!;
|
||||
|
||||
if (map?.getLayer(layerId)) {
|
||||
return;
|
||||
}
|
||||
addTrailLayer(t, layerId, i, data[i]);
|
||||
});
|
||||
if (activeTrail !== null) {
|
||||
if (
|
||||
activeTrail !== null &&
|
||||
!map?.getLayer("direction-carets")
|
||||
) {
|
||||
addCaretLayer(trails[activeTrail].id!);
|
||||
}
|
||||
|
||||
loadedAfterStyleSwitch = false;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user