Ebenen Regio und S-Bahn getrennt; Lade-Symbol pulsiert bei reduzierter Bewegung
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X48pE4bzjHej8w9HyZXCjb
This commit is contained in:
+5
-4
@@ -122,14 +122,15 @@ function setMode(mode) {
|
||||
}
|
||||
for (const m of MODES) document.getElementById("btn-" + m).onclick = () => setMode(m);
|
||||
|
||||
// ---------- Ebenen: Fernverkehr / Nahverkehr / Tram / U-Bahn, einzeln oder alle ----------
|
||||
// ---------- Ebenen: Fernverkehr / Regionalzug / S-Bahn / Tram / U-Bahn, einzeln oder alle ----------
|
||||
|
||||
const LAYER_FILTERS = {
|
||||
local: ["all", ["==", ["get", "mode"], "rail"], ["!", ["get", "fv"]]], long: ["get", "fv"],
|
||||
long: ["get", "fv"], regio: ["all", ["==", ["get", "mode"], "rail"], ["!", ["get", "fv"]], ["!", ["get", "sb"]]],
|
||||
sbahn: ["get", "sb"],
|
||||
tram: ["==", ["get", "mode"], "tram"], subway: ["==", ["get", "mode"], "subway"],
|
||||
};
|
||||
const ALL_LAYERS = Object.keys(LAYER_FILTERS);
|
||||
const layerOf = (p) => (p.mode === "rail" ? (p.fv ? "long" : "local") : p.mode);
|
||||
const layerOf = (p) => (p.mode === "rail" ? (p.fv ? "long" : p.sb ? "sbahn" : "regio") : p.mode);
|
||||
let shown = new Set(ALL_LAYERS);
|
||||
function setLayers(list) {
|
||||
shown = new Set(list.filter((k) => k in LAYER_FILTERS));
|
||||
@@ -173,7 +174,7 @@ async function getJSON(url) {
|
||||
|
||||
function updateHint() {
|
||||
// nur Trams/U-Bahnen gewählt, aber zu weit weg: sonst wäre die Karte einfach leer
|
||||
const onlyCity = !shown.has("long") && !shown.has("local");
|
||||
const onlyCity = !["long", "regio", "sbahn"].some((k) => shown.has(k));
|
||||
document.getElementById("hint").hidden = !(onlyCity && map.getZoom() < URBAN_Z);
|
||||
}
|
||||
map.on("zoomend", updateHint);
|
||||
|
||||
Reference in New Issue
Block a user