mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-19 17:22:12 +00:00
progress
This commit is contained in:
1 parent
bf946f179a
commit
ec448b72e2
10 files changed
+1079
-449
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { Selection } from 'gpx-rs';
|
||||
import type { Clipboard, Selection } from 'gpx-rs';
|
||||
import { isHidden, waypointsKey, type VisibilityState } from '$lib/file-visibility';
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,25 @@ export function selectedFileIds(selection: Selection): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether the node is one of the elements in the clipboard. */
|
||||
export function isInClipboard(clipboard: Clipboard | undefined, node: FileTreeNode): boolean {
|
||||
if (!clipboard) {
|
||||
return false;
|
||||
}
|
||||
switch (node.type) {
|
||||
case 'file':
|
||||
return clipboard.type === 'files' && clipboard.ids.includes(node.fileId);
|
||||
case 'track':
|
||||
return clipboard.type === 'tracks' && clipboard.ids.includes(node.trackId);
|
||||
case 'segment':
|
||||
return clipboard.type === 'segments' && clipboard.ids.includes(node.segmentId);
|
||||
case 'waypoint':
|
||||
return clipboard.type === 'waypoints' && clipboard.ids.includes(node.waypointId);
|
||||
case 'waypoints':
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Number of selected elements (the waypoints node counts for one). */
|
||||
export function selectionSize(selection: Selection): number {
|
||||
switch (selection.type) {
|
||||
|
||||
Reference in new issue
Block a user