fixes map style switch trail display
This commit is contained in:
@@ -109,6 +109,8 @@
|
|||||||
|
|
||||||
let hoveringTrail: boolean = false;
|
let hoveringTrail: boolean = false;
|
||||||
|
|
||||||
|
let loadedAfterStyleSwitch = false;
|
||||||
|
|
||||||
const trailColors = [
|
const trailColors = [
|
||||||
"#3549BB",
|
"#3549BB",
|
||||||
"#592E9E",
|
"#592E9E",
|
||||||
@@ -795,6 +797,7 @@
|
|||||||
layers = {};
|
layers = {};
|
||||||
map?.setStyle(style.value);
|
map?.setStyle(style.value);
|
||||||
localStorage.setItem("layer", style.text);
|
localStorage.setItem("layer", style.text);
|
||||||
|
loadedAfterStyleSwitch = true;
|
||||||
},
|
},
|
||||||
selectedIndex:
|
selectedIndex:
|
||||||
preferredMapStyleIndex !== -1 ? preferredMapStyleIndex : 0,
|
preferredMapStyleIndex !== -1 ? preferredMapStyleIndex : 0,
|
||||||
@@ -901,6 +904,20 @@
|
|||||||
type: "hillshade",
|
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) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user