This commit is contained in:
vcoppe committed 2026-10-04 15:47:09 +02:00
1 parent bf946f179a
commit ec448b72e2
10 files changed
+1079 -449

No files matched your search

+20 -1
View File
@@ -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) {