fixes map style switch trail display

This commit is contained in:
Christian Beutel
2025-03-22 13:36:11 +01:00
parent c03e5add5d
commit 4e5c900ed9

View File

@@ -109,6 +109,8 @@
let hoveringTrail: boolean = false;
let loadedAfterStyleSwitch = false;
const trailColors = [
"#3549BB",
"#592E9E",
@@ -795,6 +797,7 @@
layers = {};
map?.setStyle(style.value);
localStorage.setItem("layer", style.text);
loadedAfterStyleSwitch = true;
},
selectedIndex:
preferredMapStyleIndex !== -1 ? preferredMapStyleIndex : 0,
@@ -901,6 +904,20 @@
type: "hillshade",
});
}
if (loadedAfterStyleSwitch) {
trails.forEach((t, i) => {
const layerId = t.id!;
addTrailLayer(t, layerId, i, data[i]);
});
if (activeTrail !== null) {
console.log(activeTrail);
addCaretLayer(trails[activeTrail].id!);
}
loadedAfterStyleSwitch = false;
}
} catch (e) {}
}
});