mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 16:52:31 +00:00
progress
This commit is contained in:
@@ -2,15 +2,41 @@
|
||||
import { ScrollArea } from '$lib/components/ui/scroll-area/index';
|
||||
import FileListNode from './FileListNode.svelte';
|
||||
|
||||
import { fileObservers } from '$lib/db';
|
||||
import { fileObservers, settings } from '$lib/db';
|
||||
import { setContext } from 'svelte';
|
||||
import { ListRootItem } from './FileList';
|
||||
import { ListFileItem, ListRootItem } from './FileList';
|
||||
import { selection } from './Selection';
|
||||
|
||||
export let orientation: 'vertical' | 'horizontal';
|
||||
export let recursive = false;
|
||||
|
||||
setContext('orientation', orientation);
|
||||
setContext('recursive', recursive);
|
||||
|
||||
const { verticalFileView } = settings;
|
||||
|
||||
verticalFileView.subscribe(($vertical) => {
|
||||
if ($vertical) {
|
||||
selection.update(($selection) => {
|
||||
$selection.forEach((item) => {
|
||||
if ($selection.hasAnyChildren(item, false)) {
|
||||
$selection.toggle(item);
|
||||
}
|
||||
});
|
||||
return $selection;
|
||||
});
|
||||
} else {
|
||||
selection.update(($selection) => {
|
||||
$selection.forEach((item) => {
|
||||
if (!(item instanceof ListFileItem)) {
|
||||
$selection.toggle(item);
|
||||
$selection.set(new ListFileItem(item.getFileId()), true);
|
||||
}
|
||||
});
|
||||
return $selection;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<ScrollArea
|
||||
|
@@ -49,7 +49,7 @@
|
||||
}}
|
||||
on:mouseenter={() => {
|
||||
if (item instanceof ListWaypointItem) {
|
||||
let layer = get(gpxLayers).get(item.getFileId());
|
||||
let layer = gpxLayers.get(item.getFileId());
|
||||
let fileStore = get(fileObservers).get(item.getFileId());
|
||||
if (layer && fileStore) {
|
||||
let waypoint = get(fileStore)?.file.wpt[item.getWaypointIndex()];
|
||||
@@ -61,7 +61,7 @@
|
||||
}}
|
||||
on:mouseleave={() => {
|
||||
if (item instanceof ListWaypointItem) {
|
||||
let layer = get(gpxLayers).get(item.getFileId());
|
||||
let layer = gpxLayers.get(item.getFileId());
|
||||
if (layer) {
|
||||
layer.hideWaypointPopup();
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ export function applyToOrderedSelectedItemsFromFile(callback: (fileId: string, l
|
||||
} else if (a instanceof ListWaypointItem && b instanceof ListWaypointItem) {
|
||||
return b.getWaypointIndex() - a.getWaypointIndex();
|
||||
}
|
||||
return 0;
|
||||
return b.level - a.level;
|
||||
});
|
||||
|
||||
callback(fileId, level, items);
|
||||
|
Reference in New Issue
Block a user