From 5f8f18216d596c53023882929bc0c0909faf6910 Mon Sep 17 00:00:00 2001 From: nahkd123 Date: Fri, 4 Oct 2024 17:47:53 +0700 Subject: [PATCH] Add ability to preserve tab states --- nahara-motion-ui/src/App.svelte | 28 +++++++++++++------ .../src/ui/outliner/OutlinerPane.svelte | 1 + nahara-motion-ui/src/ui/pane/EmptyPane.svelte | 3 ++ nahara-motion-ui/src/ui/pane/PaneHost.svelte | 12 ++++++-- .../src/ui/properties/PropertiesPane.svelte | 1 + .../src/ui/timeline/TimelinePane.svelte | 1 + .../src/ui/viewport/ViewportPane.svelte | 1 + 7 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 nahara-motion-ui/src/ui/pane/EmptyPane.svelte diff --git a/nahara-motion-ui/src/App.svelte b/nahara-motion-ui/src/App.svelte index c97dc9f..ff68fd8 100644 --- a/nahara-motion-ui/src/App.svelte +++ b/nahara-motion-ui/src/App.svelte @@ -1,16 +1,26 @@ \ No newline at end of file diff --git a/nahara-motion-ui/src/ui/pane/PaneHost.svelte b/nahara-motion-ui/src/ui/pane/PaneHost.svelte index 22e73d0..6fd493f 100644 --- a/nahara-motion-ui/src/ui/pane/PaneHost.svelte +++ b/nahara-motion-ui/src/ui/pane/PaneHost.svelte @@ -7,9 +7,14 @@ Pane host is a component that includes the panes and layout management. type: T; } + export interface TabState { + type: string; + state: any; + } + export interface TabLayout extends IBaseLayout<"tab"> { /** - * An array of IDs that maps to component. + * An array of IDs that maps state ID whose type maps to component. */ tabs: string[]; selected: string; @@ -66,6 +71,7 @@ Pane host is a component that includes the panes and layout management. tabs: [], selected: "" }; + export let states: Record = {}; export let component: (name: string) => { new(...args: any[]): SvelteComponent }; export let tabNames: (id: string) => string = id => id; export let dividerSize = 8; @@ -372,7 +378,9 @@ Pane host is a component that includes the panes and layout management. })} on:paneclose={e => paneNuke(tabLayout)} > - + {#if tabLayout.selected} + + {/if} {/each} {#each splitLayouts as splitLayout} diff --git a/nahara-motion-ui/src/ui/properties/PropertiesPane.svelte b/nahara-motion-ui/src/ui/properties/PropertiesPane.svelte index 24c5c27..9624766 100644 --- a/nahara-motion-ui/src/ui/properties/PropertiesPane.svelte +++ b/nahara-motion-ui/src/ui/properties/PropertiesPane.svelte @@ -5,6 +5,7 @@ import Dropdown from "../input/Dropdown.svelte"; import { openMenuAt } from "../menu/MenuHost.svelte"; + export let state: any; const currentScene = app.currentSceneStore; const currentSelection = app.currentSelectionStore; const seekhead = app.currentSeekheadStore; diff --git a/nahara-motion-ui/src/ui/timeline/TimelinePane.svelte b/nahara-motion-ui/src/ui/timeline/TimelinePane.svelte index 8e77dfa..6c70b04 100644 --- a/nahara-motion-ui/src/ui/timeline/TimelinePane.svelte +++ b/nahara-motion-ui/src/ui/timeline/TimelinePane.svelte @@ -5,6 +5,7 @@ import { app } from "../../appglobal"; import { snapping } from "../../snapping"; + export let state: any; let labelWidth = 200; let zoom = 100; // 100 CSS pixels per second let scroll = 0; diff --git a/nahara-motion-ui/src/ui/viewport/ViewportPane.svelte b/nahara-motion-ui/src/ui/viewport/ViewportPane.svelte index c430db7..ccac774 100644 --- a/nahara-motion-ui/src/ui/viewport/ViewportPane.svelte +++ b/nahara-motion-ui/src/ui/viewport/ViewportPane.svelte @@ -8,6 +8,7 @@ import { openPopupAt } from "../popup/PopupHost.svelte"; import ColorPickerPopup from "../popup/ColorPickerPopup.svelte"; + export let state: any; let canvas: HTMLCanvasElement; let ctx: CanvasRenderingContext2D; $: {