add first tool

This commit is contained in:
vcoppe
2024-04-18 15:58:46 +02:00
parent 877d7bbf9d
commit 7ca0b3bae3
3 changed files with 11 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { reverseSelectedFiles } from '$lib/stores';
import ToolbarItem from './ToolbarItem.svelte';
import {
ArrowRightLeft,
@@ -24,9 +25,9 @@
<CalendarClock slot="icon" size="18" />
<span slot="tooltip">Change time and speed data</span>
</ToolbarItem>
<ToolbarItem>
<ToolbarItem on:click={reverseSelectedFiles}>
<ArrowRightLeft slot="icon" size="18" />
<span slot="tooltip">Reverse the order of the track points</span>
<span slot="tooltip">Reverse the file</span>
</ToolbarItem>
<ToolbarItem>
<Group slot="icon" size="18" />
@@ -46,7 +47,9 @@
</ToolbarItem>
<ToolbarItem>
<SquareDashedMousePointer slot="icon" size="18" />
<span slot="tooltip">Clean track points and POIs with a rectangle selection</span>
<span slot="tooltip"
>Clean track points and points of interest with a rectangle selection</span
>
</ToolbarItem>
<ToolbarItem>
<Palette slot="icon" size="18" />

View File

@@ -12,6 +12,7 @@
variant="ghost"
class="h-fit px-1 py-1.5"
disabled={$selectedFiles.size == 0}
on:click
>
<slot name="icon" />
</Button>

View File

@@ -105,6 +105,10 @@ export function exportFile(file: GPXFile) {
URL.revokeObjectURL(url);
}
export function reverseSelectedFiles() {
get(selectedFiles).forEach(file => file.reverse());
}
export function selectFile(file: GPXFile) {
selectedFiles.update($selectedFiles => {
$selectedFiles.clear();