This commit is contained in:
vcoppe
2024-09-20 10:15:28 +02:00
parent 930b4b84ed
commit f94edf3e3a
10 changed files with 884 additions and 898 deletions

View File

@@ -11,9 +11,9 @@
import * as RadioGroup from '$lib/components/ui/radio-group'; import * as RadioGroup from '$lib/components/ui/radio-group';
import { Button } from '$lib/components/ui/button'; import { Button } from '$lib/components/ui/button';
import Help from '$lib/components/Help.svelte'; import Help from '$lib/components/Help.svelte';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { onDestroy, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { resetCursor, setCrosshairCursor } from '$lib/utils'; import { getURLForLanguage, resetCursor, setCrosshairCursor } from '$lib/utils';
import { Trash2 } from 'lucide-svelte'; import { Trash2 } from 'lucide-svelte';
import { map } from '$lib/stores'; import { map } from '$lib/stores';
import { selection } from '$lib/components/file-list/Selection'; import { selection } from '$lib/components/file-list/Selection';
@@ -178,7 +178,7 @@
<Trash2 size="16" class="mr-1" /> <Trash2 size="16" class="mr-1" />
{$_('toolbar.clean.button')} {$_('toolbar.clean.button')}
</Button> </Button>
<Help link="./help/toolbar/clean"> <Help link={getURLForLanguage($locale, '/help/toolbar/clean')}>
{#if validSelection} {#if validSelection}
{$_('toolbar.clean.help')} {$_('toolbar.clean.help')}
{:else} {:else}

View File

@@ -5,7 +5,8 @@
import { MountainSnow } from 'lucide-svelte'; import { MountainSnow } from 'lucide-svelte';
import { dbUtils } from '$lib/db'; import { dbUtils } from '$lib/db';
import { map } from '$lib/stores'; import { map } from '$lib/stores';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { getURLForLanguage } from '$lib/utils';
$: validSelection = $selection.size > 0; $: validSelection = $selection.size > 0;
</script> </script>
@@ -24,7 +25,7 @@
<MountainSnow size="16" class="mr-1 shrink-0" /> <MountainSnow size="16" class="mr-1 shrink-0" />
{$_('toolbar.elevation.button')} {$_('toolbar.elevation.button')}
</Button> </Button>
<Help link="./help/toolbar/elevation"> <Help link={getURLForLanguage($locale, '/help/toolbar/elevation')}>
{#if validSelection} {#if validSelection}
{$_('toolbar.elevation.help')} {$_('toolbar.elevation.help')}
{:else} {:else}

View File

@@ -11,7 +11,8 @@
} from '$lib/components/file-list/FileList'; } from '$lib/components/file-list/FileList';
import Help from '$lib/components/Help.svelte'; import Help from '$lib/components/Help.svelte';
import { dbUtils, getFile } from '$lib/db'; import { dbUtils, getFile } from '$lib/db';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { getURLForLanguage } from '$lib/utils';
$: validSelection = $: validSelection =
$selection.size > 0 && $selection.size > 0 &&
@@ -42,7 +43,7 @@
<Ungroup size="16" class="mr-1" /> <Ungroup size="16" class="mr-1" />
{$_('toolbar.extract.button')} {$_('toolbar.extract.button')}
</Button> </Button>
<Help link="./help/toolbar/extract"> <Help link={getURLForLanguage($locale, '/help/toolbar/extract')}>
{#if validSelection} {#if validSelection}
{$_('toolbar.extract.help')} {$_('toolbar.extract.help')}
{:else} {:else}

View File

@@ -12,9 +12,10 @@
import { Button } from '$lib/components/ui/button'; import { Button } from '$lib/components/ui/button';
import { Label } from '$lib/components/ui/label/index.js'; import { Label } from '$lib/components/ui/label/index.js';
import * as RadioGroup from '$lib/components/ui/radio-group'; import * as RadioGroup from '$lib/components/ui/radio-group';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { dbUtils, getFile } from '$lib/db'; import { dbUtils, getFile } from '$lib/db';
import { Group } from 'lucide-svelte'; import { Group } from 'lucide-svelte';
import { getURLForLanguage } from '$lib/utils';
let canMergeTraces = false; let canMergeTraces = false;
let canMergeContents = false; let canMergeContents = false;
@@ -75,7 +76,7 @@
<Group size="16" class="mr-1 shrink-0" /> <Group size="16" class="mr-1 shrink-0" />
{$_('toolbar.merge.merge_selection')} {$_('toolbar.merge.merge_selection')}
</Button> </Button>
<Help link="./help/toolbar/merge"> <Help link={getURLForLanguage($locale, '/help/toolbar/merge')}>
{#if mergeType === MergeType.TRACES && canMergeTraces} {#if mergeType === MergeType.TRACES && canMergeTraces}
{$_('toolbar.merge.help_merge_traces')} {$_('toolbar.merge.help_merge_traces')}
{:else if mergeType === MergeType.TRACES && !canMergeTraces} {:else if mergeType === MergeType.TRACES && !canMergeTraces}

View File

@@ -3,20 +3,17 @@
import { Button } from '$lib/components/ui/button'; import { Button } from '$lib/components/ui/button';
import { Slider } from '$lib/components/ui/slider'; import { Slider } from '$lib/components/ui/slider';
import { selection } from '$lib/components/file-list/Selection'; import { selection } from '$lib/components/file-list/Selection';
import { import { ListItem, ListRootItem, ListTrackSegmentItem } from '$lib/components/file-list/FileList';
ListItem,
ListRootItem,
ListTrackSegmentItem
} from '$lib/components/file-list/FileList';
import Help from '$lib/components/Help.svelte'; import Help from '$lib/components/Help.svelte';
import { Filter } from 'lucide-svelte'; import { Filter } from 'lucide-svelte';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import WithUnits from '$lib/components/WithUnits.svelte'; import WithUnits from '$lib/components/WithUnits.svelte';
import { dbUtils, fileObservers } from '$lib/db'; import { dbUtils, fileObservers } from '$lib/db';
import { map } from '$lib/stores'; import { map } from '$lib/stores';
import { onDestroy } from 'svelte'; import { onDestroy } from 'svelte';
import { ramerDouglasPeucker, TrackPoint, type SimplifiedTrackPoint } from 'gpx'; import { ramerDouglasPeucker, TrackPoint, type SimplifiedTrackPoint } from 'gpx';
import { derived } from 'svelte/store'; import { derived } from 'svelte/store';
import { getURLForLanguage } from '$lib/utils';
let sliderValue = [50]; let sliderValue = [50];
let maxPoints = 0; let maxPoints = 0;
@@ -94,17 +91,11 @@
}); });
$fileObservers.forEach((fileStore, fileId) => { $fileObservers.forEach((fileStore, fileId) => {
if (!unsubscribes.has(fileId)) { if (!unsubscribes.has(fileId)) {
let unsubscribe = derived([fileStore, selection], ([fs, sel]) => [ let unsubscribe = derived([fileStore, selection], ([fs, sel]) => [fs, sel]).subscribe(
fs, ([fs, sel]) => {
sel
]).subscribe(([fs, sel]) => {
if (fs) { if (fs) {
fs.file.forEachSegment((segment, trackIndex, segmentIndex) => { fs.file.forEachSegment((segment, trackIndex, segmentIndex) => {
let segmentItem = new ListTrackSegmentItem( let segmentItem = new ListTrackSegmentItem(fileId, trackIndex, segmentIndex);
fileId,
trackIndex,
segmentIndex
);
if (sel.hasAnyParent(segmentItem)) { if (sel.hasAnyParent(segmentItem)) {
let statistics = fs.statistics.getStatisticsFor(segmentItem); let statistics = fs.statistics.getStatisticsFor(segmentItem);
simplified.set(segmentItem.getFullId(), [ simplified.set(segmentItem.getFullId(), [
@@ -119,7 +110,8 @@
} }
}); });
} }
}); }
);
unsubscribes.set(fileId, unsubscribe); unsubscribes.set(fileId, unsubscribe);
} }
}); });
@@ -173,7 +165,7 @@
{$_('toolbar.reduce.button')} {$_('toolbar.reduce.button')}
</Button> </Button>
<Help link="./help/toolbar/minify"> <Help link={getURLForLanguage($locale, '/help/toolbar/minify')}>
{#if validSelection} {#if validSelection}
{$_('toolbar.reduce.help')} {$_('toolbar.reduce.help')}
{:else} {:else}

View File

@@ -26,6 +26,7 @@
ListTrackSegmentItem ListTrackSegmentItem
} from '$lib/components/file-list/FileList'; } from '$lib/components/file-list/FileList';
import Help from '$lib/components/Help.svelte'; import Help from '$lib/components/Help.svelte';
import { getURLForLanguage } from '$lib/utils';
let startDate: DateValue | undefined = undefined; let startDate: DateValue | undefined = undefined;
let startTime: string | undefined = undefined; let startTime: string | undefined = undefined;
@@ -304,11 +305,7 @@
class="grow whitespace-normal h-fit" class="grow whitespace-normal h-fit"
on:click={() => { on:click={() => {
let effectiveSpeed = getSpeed(); let effectiveSpeed = getSpeed();
if ( if (startDate === undefined || startTime === undefined || effectiveSpeed === undefined) {
startDate === undefined ||
startTime === undefined ||
effectiveSpeed === undefined
) {
return; return;
} }
@@ -329,16 +326,9 @@
dbUtils.applyToFile(fileId, (file) => { dbUtils.applyToFile(fileId, (file) => {
if (item instanceof ListFileItem) { if (item instanceof ListFileItem) {
if (artificial) { if (artificial) {
file.createArtificialTimestamps( file.createArtificialTimestamps(getDate(startDate, startTime), movingTime);
getDate(startDate, startTime),
movingTime
);
} else { } else {
file.changeTimestamps( file.changeTimestamps(getDate(startDate, startTime), effectiveSpeed, ratio);
getDate(startDate, startTime),
effectiveSpeed,
ratio
);
} }
} else if (item instanceof ListTrackItem) { } else if (item instanceof ListTrackItem) {
if (artificial) { if (artificial) {
@@ -383,7 +373,7 @@
<CircleX size="16" /> <CircleX size="16" />
</Button> </Button>
</div> </div>
<Help link="./help/toolbar/time"> <Help link={getURLForLanguage($locale, '/help/toolbar/time')}>
{#if canUpdate} {#if canUpdate}
{$_('toolbar.time.help')} {$_('toolbar.time.help')}
{:else} {:else}

View File

@@ -19,7 +19,7 @@
import Help from '$lib/components/Help.svelte'; import Help from '$lib/components/Help.svelte';
import { onDestroy, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { map } from '$lib/stores'; import { map } from '$lib/stores';
import { resetCursor, setCrosshairCursor } from '$lib/utils'; import { getURLForLanguage, resetCursor, setCrosshairCursor } from '$lib/utils';
import { CirclePlus, CircleX, Save } from 'lucide-svelte'; import { CirclePlus, CircleX, Save } from 'lucide-svelte';
import { getSymbolKey, symbols } from '$lib/assets/symbols'; import { getSymbolKey, symbols } from '$lib/assets/symbols';
@@ -262,7 +262,7 @@
<CircleX size="16" /> <CircleX size="16" />
</Button> </Button>
</div> </div>
<Help link="./help/toolbar/poi"> <Help link={getURLForLanguage($locale, '/help/toolbar/poi')}>
{#if $selectedWaypoint || canCreate} {#if $selectedWaypoint || canCreate}
{$_('toolbar.waypoint.help')} {$_('toolbar.waypoint.help')}
{:else} {:else}

View File

@@ -25,7 +25,7 @@
import { dbUtils, getFile, getFileIds, settings } from '$lib/db'; import { dbUtils, getFile, getFileIds, settings } from '$lib/db';
import { brouterProfiles, routingProfileSelectItem } from './Routing'; import { brouterProfiles, routingProfileSelectItem } from './Routing';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { RoutingControls } from './RoutingControls'; import { RoutingControls } from './RoutingControls';
import mapboxgl from 'mapbox-gl'; import mapboxgl from 'mapbox-gl';
import { fileObservers } from '$lib/db'; import { fileObservers } from '$lib/db';
@@ -38,7 +38,7 @@
ListTrackSegmentItem, ListTrackSegmentItem,
type ListItem type ListItem
} from '$lib/components/file-list/FileList'; } from '$lib/components/file-list/FileList';
import { flyAndScale, resetCursor, setCrosshairCursor } from '$lib/utils'; import { flyAndScale, getURLForLanguage, resetCursor, setCrosshairCursor } from '$lib/utils';
import { onDestroy, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { TrackPoint } from 'gpx'; import { TrackPoint } from 'gpx';
@@ -236,7 +236,7 @@
</Tooltip> </Tooltip>
</div> </div>
<div class="w-full flex flex-row gap-2 items-end justify-between"> <div class="w-full flex flex-row gap-2 items-end justify-between">
<Help link="./help/toolbar/routing"> <Help link={getURLForLanguage($locale, '/help/toolbar/routing')}>
{#if !validSelection} {#if !validSelection}
{$_('toolbar.routing.help_no_file')} {$_('toolbar.routing.help_no_file')}
{:else} {:else}

View File

@@ -17,11 +17,12 @@
import { Separator } from '$lib/components/ui/separator'; import { Separator } from '$lib/components/ui/separator';
import { gpxStatistics, map, slicedGPXStatistics, splitAs } from '$lib/stores'; import { gpxStatistics, map, slicedGPXStatistics, splitAs } from '$lib/stores';
import { get } from 'svelte/store'; import { get } from 'svelte/store';
import { _ } from 'svelte-i18n'; import { _, locale } from 'svelte-i18n';
import { onDestroy, tick } from 'svelte'; import { onDestroy, tick } from 'svelte';
import { Crop } from 'lucide-svelte'; import { Crop } from 'lucide-svelte';
import { dbUtils } from '$lib/db'; import { dbUtils } from '$lib/db';
import { SplitControls } from './SplitControls'; import { SplitControls } from './SplitControls';
import { getURLForLanguage } from '$lib/utils';
let splitControls: SplitControls | undefined = undefined; let splitControls: SplitControls | undefined = undefined;
let canCrop = false; let canCrop = false;
@@ -135,7 +136,7 @@
</Select.Content> </Select.Content>
</Select.Root> </Select.Root>
</Label> </Label>
<Help link="./help/toolbar/scissors"> <Help link={getURLForLanguage($locale, '/help/toolbar/scissors')}>
{#if validSelection} {#if validSelection}
{$_('toolbar.scissors.help')} {$_('toolbar.scissors.help')}
{:else} {:else}

View File

@@ -40,7 +40,7 @@ By right-clicking on a file tab, you can access the same actions as in the [edit
### Vertical layout ### Vertical layout
As mentioned in the [view options section](./menu/view), you can switch between a horizontal and a vertical layout for the file list. As mentioned in the [view options section](./menu/view), you can switch between a horizontal and a vertical layout for the file list.
The vertical file list is useful when you have many files open, or files with multiple [tracks, segments, or points of interest](../gpx). The vertical file list is useful when you have many files open, or files with multiple [tracks, segments, or points of interest](./gpx).
Indeed, this layout allows you to inspect the content of the files through collapsible sections. Indeed, this layout allows you to inspect the content of the files through collapsible sections.
You can also apply [edit actions](./menu/edit) and [tools](./toolbar/) to internal file items. You can also apply [edit actions](./menu/edit) and [tools](./toolbar/) to internal file items.