@setoelkahfi / svara / commits / 2988dc9

fix: sidebar panel no longer the wrong size after unminimizing

mellbacon committed Aug 20, 2023 at 18:48 UTC 2988dc91edb328d27f83949d9668b837a97f5fd9
1 file changed +25 -17
src/App.svelte
+25 -17
@@ -34,7 +34,10 @@
34 }
35 }
36
37 - function updateMinPanelSize() {
37 + async function updateMinPanelSize() {
38 + if (!await appWindow.isFocused()) {
39 + return;
40 + }
41 // TODO: make this better
42 if ($resolution <= 700) {
43 minPanelSize = 30;
@@ -61,6 +64,7 @@
64 const _openPopup = writable(false);
65 const popupProps = writable({});
66 const popup = writable(null);
67 + export const fullscreen = writable(false);
68
69 export function openInputModal(title: string, description: string, buttons: any[], options = undefined) {
70 popup.set(InputModal);
@@ -76,24 +80,28 @@
80
81 <svelte:window on:contextmenu|preventDefault></svelte:window>
82
79 -<Header />
80 -<div id="main">
81 - <Sidebar />
82 - <Splitpanes on:resized={updatePanelSize} on:resize={updateMinPanelSize} theme="editor-panes">
83 - {#if $showsidebarview}
84 - <Pane bind:size={panelSize} bind:minSize={minPanelSize} maxSize={60}>
85 - <SidebarView content={$tool.content}></SidebarView>
83 +{#if !$fullscreen}
84 + <Header />
85 +{/if}
86 +<div id="_">
87 + <div id="main" class:fullscreen={$fullscreen}>
88 + <Sidebar />
89 + <Splitpanes on:resized={updatePanelSize} on:resize={updateMinPanelSize} theme="editor-panes">
90 + {#if $showsidebarview}
91 + <Pane bind:size={panelSize} bind:minSize={minPanelSize} maxSize={60}>
92 + <SidebarView content={$tool.content}></SidebarView>
93 + </Pane>
94 + {/if}
95 + <Pane>
96 + <div id="container">
97 + <EditorTabList />
98 + <div id="tabview" class:hidden={$hidden}></div>
99 + </div>
100 </Pane>
87 - {/if}
88 - <Pane>
89 - <div id="container">
90 - <EditorTabList />
91 - <div id="tabview" class:hidden={$hidden}></div>
92 - </div>
93 - </Pane>
94 - </Splitpanes>
101 + </Splitpanes>
102 + </div>
103 + <Statusbar />
104 </div>
96 -<Statusbar />
105
106 {#if $_openPopup}
107 <svelte:component this={$popup} {...$popupProps}></svelte:component>