store gradient preference

This commit is contained in:
Christian Beutel
2024-06-15 19:26:04 +02:00
parent 523a6040bc
commit eef743b947
2 changed files with 6 additions and 2 deletions

View File

@@ -95,5 +95,5 @@
d="M43.857 43.3045C44.0569 43.0652 44.4246 43.0652 44.6245 43.3045L46.6259 45.7008C46.8978 46.0263 46.6663 46.5213 46.2421 46.5213H42.2394C41.8152 46.5213 41.5837 46.0263 41.8556 45.7008L43.857 43.3045Z"
fill="#242734"
/>
<text x="178" y="64" fill="white" font-size="0.75rem">v0.6.1</text>
<text x="178" y="64" fill="white" font-size="0.75rem">v0.7.0</text>
</svg>

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -116,6 +116,9 @@
localStorage.setItem("layer", e.name);
});
const localMetric = localStorage.getItem("gradient") as any ?? "altitude";
selectedMetric = localMetric === "false" ? false : localMetric;
const default_elevation_options = {
height: 200,
@@ -150,7 +153,7 @@
// Toggle "leaflet-edgescale" integration
edgeScale: false,
// Toggle "leaflet-hotline" integration
hotline: "altitude",
hotline: selectedMetric,
// Display track datetimes: true || false
timestamps: false,
waypoints: false,
@@ -206,6 +209,7 @@
autofitBounds: false,
});
selectedMetric = metric;
localStorage.setItem("gradient", metric.toString());
controlElevation.clear();
controlElevation.load(gpxData);
}