Fixing UI editing mode
This commit is contained in:
@@ -4,6 +4,7 @@ import type ComfyApp from "$lib/components/ComfyApp"
|
||||
import type { LGraphNode, IWidget } from "@litegraph-ts/core"
|
||||
import nodeState from "$lib/state/nodeState";
|
||||
import type { NodeStateStore } from './nodeState';
|
||||
import { dndzone, SHADOW_PLACEHOLDER_ITEM_ID } from 'svelte-dnd-action';
|
||||
|
||||
type DragItemEntry = {
|
||||
dragItem: IDragItem,
|
||||
@@ -136,6 +137,8 @@ function updateChildren(parent: IDragItem, children: IDragItem[]): IDragItem[] {
|
||||
const state = get(store);
|
||||
state.allItems[parent.id].children = children;
|
||||
for (const child of children) {
|
||||
if (child.id === SHADOW_PLACEHOLDER_ITEM_ID)
|
||||
continue;
|
||||
state.allItems[child.id].parent = parent;
|
||||
}
|
||||
store.set(state)
|
||||
|
||||
@@ -2,11 +2,13 @@ import { writable } from 'svelte/store';
|
||||
import type { Readable, Writable } from 'svelte/store';
|
||||
import type ComfyApp from "$lib/components/ComfyApp"
|
||||
|
||||
export type UIEditMode = "disabled" | "widgets" | "containers" | "layout";
|
||||
|
||||
export type UIState = {
|
||||
app: ComfyApp,
|
||||
nodesLocked: boolean,
|
||||
graphLocked: boolean,
|
||||
unlocked: boolean,
|
||||
uiEditMode: UIEditMode
|
||||
}
|
||||
|
||||
export type WritableUIStateStore = Writable<UIState>;
|
||||
@@ -14,7 +16,7 @@ const store: WritableUIStateStore = writable(
|
||||
{
|
||||
graphLocked: true,
|
||||
nodesLocked: false,
|
||||
unlocked: false,
|
||||
uiEditMode: "disabled",
|
||||
})
|
||||
|
||||
const uiStateStore: WritableUIStateStore =
|
||||
|
||||
Reference in New Issue
Block a user