mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
add new track/segment to edit menu, and to docs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -248,10 +248,7 @@
|
|||||||
{#if item instanceof ListFileItem}
|
{#if item instanceof ListFileItem}
|
||||||
<ContextMenu.Item
|
<ContextMenu.Item
|
||||||
disabled={!singleSelection}
|
disabled={!singleSelection}
|
||||||
on:click={() =>
|
on:click={() => dbUtils.addNewTrack(item.getFileId())}
|
||||||
dbUtils.applyToFile(item.getFileId(), (file) =>
|
|
||||||
file.replaceTracks(file.trk.length, file.trk.length, [new Track()])
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<Plus size="16" class="mr-1" />
|
<Plus size="16" class="mr-1" />
|
||||||
{$_('menu.new_track')}
|
{$_('menu.new_track')}
|
||||||
@@ -260,17 +257,7 @@
|
|||||||
{:else if item instanceof ListTrackItem}
|
{:else if item instanceof ListTrackItem}
|
||||||
<ContextMenu.Item
|
<ContextMenu.Item
|
||||||
disabled={!singleSelection}
|
disabled={!singleSelection}
|
||||||
on:click={() => {
|
on:click={() => dbUtils.addNewSegment(item.getFileId(), item.getTrackIndex())}
|
||||||
let trackIndex = item.getTrackIndex();
|
|
||||||
dbUtils.applyToFile(item.getFileId(), (file) =>
|
|
||||||
file.replaceTrackSegments(
|
|
||||||
trackIndex,
|
|
||||||
file.trk[trackIndex].trkseg.length,
|
|
||||||
file.trk[trackIndex].trkseg.length,
|
|
||||||
[new TrackSegment()]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Plus size="16" class="mr-1" />
|
<Plus size="16" class="mr-1" />
|
||||||
{$_('menu.new_segment')}
|
{$_('menu.new_segment')}
|
||||||
|
@@ -512,6 +512,15 @@ export const dbUtils = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
addNewTrack: (fileId: string) => {
|
||||||
|
dbUtils.applyToFile(fileId, (file) => file.replaceTracks(file.trk.length, file.trk.length, [new Track()]));
|
||||||
|
},
|
||||||
|
addNewSegment: (fileId: string, trackIndex: number) => {
|
||||||
|
dbUtils.applyToFile(fileId, (file) => {
|
||||||
|
let track = file.trk[trackIndex];
|
||||||
|
track.replaceTrackSegments(track.trkseg.length, track.trkseg.length, [new TrackSegment()]);
|
||||||
|
});
|
||||||
|
},
|
||||||
reverseSelection: () => {
|
reverseSelection: () => {
|
||||||
if (!get(selection).hasAnyChildren(new ListRootItem(), true, ['waypoints']) || get(gpxStatistics).local.points?.length <= 1) {
|
if (!get(selection).hasAnyChildren(new ListRootItem(), true, ['waypoints']) || get(gpxStatistics).local.points?.length <= 1) {
|
||||||
return;
|
return;
|
||||||
|
@@ -3,7 +3,7 @@ title: Edit actions
|
|||||||
---
|
---
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Undo2, Redo2, Info, PaintBucket, EyeOff, FileStack, ClipboardCopy, Scissors, ClipboardPaste, Trash2, Maximize } from 'lucide-svelte';
|
import { Undo2, Redo2, Info, PaintBucket, EyeOff, FileStack, ClipboardCopy, Scissors, ClipboardPaste, Trash2, Maximize, Plus } from 'lucide-svelte';
|
||||||
import DocsNote from '$lib/components/docs/DocsNote.svelte';
|
import DocsNote from '$lib/components/docs/DocsNote.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -31,6 +31,28 @@ Open the appearance dialog, where you can change the color, opacity, and width o
|
|||||||
|
|
||||||
Toggle the visibility of the selected file items on the map.
|
Toggle the visibility of the selected file items on the map.
|
||||||
|
|
||||||
|
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> New track
|
||||||
|
|
||||||
|
Create a new track in the selected file.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
This action is only available when the vertical layout of the files list is enabled.
|
||||||
|
Additionally, the selection must be a single file.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
|
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> New segment
|
||||||
|
|
||||||
|
Create a new segment in the selected track.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
This action is only available when the vertical layout of the files list is enabled.
|
||||||
|
Additionally, the selection must be a single track.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
Reference in New Issue
Block a user