mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
open collapsibles if needed
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
import { get, type Readable } from 'svelte/store';
|
||||
import FileListNodeContent from './FileListNodeContent.svelte';
|
||||
import FileListNodeLabel from './FileListNodeLabel.svelte';
|
||||
import { getContext, onDestroy } from 'svelte';
|
||||
import { afterUpdate, getContext } from 'svelte';
|
||||
import {
|
||||
ListTrackSegmentItem,
|
||||
ListWaypointItem,
|
||||
@@ -46,15 +46,18 @@
|
||||
: '';
|
||||
|
||||
const { verticalFileView } = settings;
|
||||
const unsubscribe = selection.subscribe(($selection) => {
|
||||
|
||||
function openIfSelectedChild() {
|
||||
if (collapsible && get(verticalFileView) && $selection.hasAnyChildren(item, false)) {
|
||||
collapsible.openNode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
unsubscribe();
|
||||
});
|
||||
if ($selection) {
|
||||
openIfSelectedChild();
|
||||
}
|
||||
|
||||
afterUpdate(openIfSelectedChild);
|
||||
</script>
|
||||
|
||||
{#if node instanceof Map}
|
||||
|
@@ -198,8 +198,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
let firstUpdateAfterMount = false;
|
||||
onMount(() => {
|
||||
createSortable();
|
||||
firstUpdateAfterMount = true;
|
||||
});
|
||||
|
||||
afterUpdate(() => {
|
||||
@@ -218,7 +220,10 @@
|
||||
});
|
||||
|
||||
syncFileOrder();
|
||||
updateFromSelection();
|
||||
if (firstUpdateAfterMount) {
|
||||
firstUpdateAfterMount = false;
|
||||
updateFromSelection();
|
||||
}
|
||||
});
|
||||
|
||||
function getChangedIds() {
|
||||
|
Reference in New Issue
Block a user