mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 12:28:12 +08:00
Unwrap the Layout enum to replace it with the WidgetLayout struct now called Layout (#3448)
This commit is contained in:
@@ -4,7 +4,7 @@ import { writable } from "svelte/store";
|
||||
import { type Editor } from "@graphite/editor";
|
||||
|
||||
import {
|
||||
patchWidgetLayout,
|
||||
patchLayout,
|
||||
UpdateDocumentBarLayout,
|
||||
UpdateDocumentModeLayout,
|
||||
UpdateToolOptionsLayout,
|
||||
@@ -13,18 +13,18 @@ import {
|
||||
UpdateNodeGraphControlBarLayout,
|
||||
UpdateGraphViewOverlay,
|
||||
UpdateGraphFadeArtwork,
|
||||
type LayoutGroup,
|
||||
} from "@graphite/messages";
|
||||
import type { Layout } from "@graphite/messages";
|
||||
|
||||
export function createDocumentState(editor: Editor) {
|
||||
const state = writable({
|
||||
// Layouts
|
||||
documentModeLayout: [] as LayoutGroup[],
|
||||
toolOptionsLayout: [] as LayoutGroup[],
|
||||
documentBarLayout: [] as LayoutGroup[],
|
||||
toolShelfLayout: [] as LayoutGroup[],
|
||||
workingColorsLayout: [] as LayoutGroup[],
|
||||
nodeGraphControlBarLayout: [] as LayoutGroup[],
|
||||
documentModeLayout: [] as Layout,
|
||||
toolOptionsLayout: [] as Layout,
|
||||
documentBarLayout: [] as Layout,
|
||||
toolShelfLayout: [] as Layout,
|
||||
workingColorsLayout: [] as Layout,
|
||||
nodeGraphControlBarLayout: [] as Layout,
|
||||
// Graph view overlay
|
||||
graphViewOverlayOpen: false,
|
||||
fadeArtwork: 100,
|
||||
@@ -42,7 +42,7 @@ export function createDocumentState(editor: Editor) {
|
||||
await tick();
|
||||
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.documentModeLayout, updateDocumentModeLayout);
|
||||
patchLayout(state.documentModeLayout, updateDocumentModeLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
@@ -50,7 +50,7 @@ export function createDocumentState(editor: Editor) {
|
||||
await tick();
|
||||
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.toolOptionsLayout, updateToolOptionsLayout);
|
||||
patchLayout(state.toolOptionsLayout, updateToolOptionsLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
@@ -58,7 +58,7 @@ export function createDocumentState(editor: Editor) {
|
||||
await tick();
|
||||
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.documentBarLayout, updateDocumentBarLayout);
|
||||
patchLayout(state.documentBarLayout, updateDocumentBarLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
@@ -66,7 +66,7 @@ export function createDocumentState(editor: Editor) {
|
||||
await tick();
|
||||
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.toolShelfLayout, updateToolShelfLayout);
|
||||
patchLayout(state.toolShelfLayout, updateToolShelfLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
@@ -74,13 +74,13 @@ export function createDocumentState(editor: Editor) {
|
||||
await tick();
|
||||
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.workingColorsLayout, updateWorkingColorsLayout);
|
||||
patchLayout(state.workingColorsLayout, updateWorkingColorsLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphControlBarLayout, (updateNodeGraphControlBarLayout) => {
|
||||
update((state) => {
|
||||
patchWidgetLayout(state.nodeGraphControlBarLayout, updateNodeGraphControlBarLayout);
|
||||
patchLayout(state.nodeGraphControlBarLayout, updateNodeGraphControlBarLayout);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user