mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-05 18:02:55 +00:00
duplicate any selection
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
import { get, writable } from "svelte/store";
|
||||
import { ListFileItem, ListRootItem, SelectionTreeType } from "./FileList";
|
||||
import { ListFileItem, ListItem, ListRootItem, SelectionTreeType } from "./FileList";
|
||||
import { fileObservers } from "$lib/db";
|
||||
|
||||
export const selection = writable<SelectionTreeType>(new SelectionTreeType(new ListRootItem()));
|
||||
|
||||
export function select(fileId: string) {
|
||||
export function selectItem(item: ListItem) {
|
||||
selection.update(($selection) => {
|
||||
$selection.clear();
|
||||
$selection.set(new ListFileItem(fileId), true);
|
||||
$selection.set(item, true);
|
||||
return $selection;
|
||||
});
|
||||
}
|
||||
|
||||
export function selectFile(fileId: string) {
|
||||
selectItem(new ListFileItem(fileId));
|
||||
}
|
||||
|
||||
export function addSelect(fileId: string) {
|
||||
selection.update(($selection) => {
|
||||
$selection.toggle(new ListFileItem(fileId));
|
||||
|
Reference in New Issue
Block a user