adds check marker for gradient option

This commit is contained in:
Christian Beutel
2024-06-15 19:13:51 +02:00
parent 6a6308255c
commit 523a6040bc
2 changed files with 30 additions and 8 deletions

View File

@@ -71,7 +71,7 @@
on:mousedown|stopPropagation={() => handleItemClick(item)} on:mousedown|stopPropagation={() => handleItemClick(item)}
> >
{#if item.icon} {#if item.icon}
<i class="fa fa-{item.icon} mr-3"></i> <i class="fa-regular fa-{item.icon} mr-3"></i>
{/if} {/if}
<span class="whitespace-nowrap">{item.text}</span> <span class="whitespace-nowrap">{item.text}</span>
</li> </li>

View File

@@ -23,6 +23,8 @@
let L: any; let L: any;
let controlElevation: any; let controlElevation: any;
let selectedMetric: "altitude" | "slope" | "speed" | false = "altitude";
$: gpxData = trail?.expand.gpx_data; $: gpxData = trail?.expand.gpx_data;
$: if (gpxData && controlElevation) { $: if (gpxData && controlElevation) {
controlElevation.clear(); controlElevation.clear();
@@ -33,11 +35,27 @@
controlElevation?.updateOptions(options); controlElevation?.updateOptions(options);
} }
const hotlineSwitcherItems: DropdownItem[] = [ $: hotlineSwitcherItems = [
{ text: $_("altitude"), value: "altitude" }, {
{ text: $_("slope"), value: "slope" }, text: $_("altitude"),
{ text: $_("speed"), value: "speed" }, value: "altitude",
{ text: $_("off"), value: false }, icon: selectedMetric == "altitude" ? "square-check" : "square",
},
{
text: $_("slope"),
value: "slope",
icon: selectedMetric == "slope" ? "square-check" : "square",
},
{
text: $_("speed"),
value: "speed",
icon: selectedMetric == "speed" ? "square-check" : "square",
},
{
text: $_("off"),
value: false,
icon: selectedMetric == false ? "square-check" : "square",
},
]; ];
onMount(async () => { onMount(async () => {
@@ -183,7 +201,11 @@
}); });
function switchHotline(metric: "altitude" | "slope" | "speed" | false) { function switchHotline(metric: "altitude" | "slope" | "speed" | false) {
controlElevation.updateOptions({ hotline: metric, autofitBounds: false }); controlElevation.updateOptions({
hotline: metric,
autofitBounds: false,
});
selectedMetric = metric;
controlElevation.clear(); controlElevation.clear();
controlElevation.load(gpxData); controlElevation.load(gpxData);
} }
@@ -204,7 +226,7 @@
let:toggleMenu={openDropdown} let:toggleMenu={openDropdown}
> >
<button <button
class="rounded-sm bg-white text-black hover:bg-gray-200 focus:ring-4 ring-gray-100/50 transition-colors h-11 w-11" class="rounded-md border-2 border-black border-opacity-30 bg-white text-black hover:bg-gray-200 focus:ring-4 ring-gray-100/50 transition-colors h-12 w-12"
on:click={openDropdown} on:click={openDropdown}
> >
<i class="fa fa-route text-lg"></i> <i class="fa fa-route text-lg"></i>