From e8452704eb93258ee862b601111a60a58f10b917 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 1 Sep 2022 14:55:20 +0200 Subject: [PATCH] perspective collapsible splitters --- .../src/elements/HorizontalSplitter.svelte | 102 ++++++++++++++++-- .../web/src/elements/VerticalSplitter.svelte | 4 +- .../src/perspectives/PerspectiveView.svelte | 2 +- 3 files changed, 95 insertions(+), 13 deletions(-) diff --git a/packages/web/src/elements/HorizontalSplitter.svelte b/packages/web/src/elements/HorizontalSplitter.svelte index 359785c5..5d38eb74 100644 --- a/packages/web/src/elements/HorizontalSplitter.svelte +++ b/packages/web/src/elements/HorizontalSplitter.svelte @@ -11,6 +11,7 @@
- {#if !hideFirst} -
- -
- {/if} - {#if isSplitter} - {#if !hideFirst} -
(size += e.detail)} /> - {/if} -
+ {#if collapsed1} +
+ {:else if collapsed2} +
+ +
+ {:else} + {#if !hideFirst} +
+ +
+ {/if} + {#if isSplitter} + {#if !hideFirst} +
(size += e.detail)} /> + {/if} +
+ +
+ {/if} + {/if} + + {#if allowCollapseChild1 && !collapsed2 && isSplitter} + {#if collapsed1} +
{ + collapsed1 = false; + }} + > + +
+ {:else} +
{ + collapsed1 = true; + }} + > + +
+ {/if} + {/if} + + {#if allowCollapseChild2 && !collapsed1 && isSplitter} + {#if collapsed2} +
{ + collapsed2 = false; + }} + > + +
+ {:else} +
{ + collapsed2 = true; + }} + > + +
+ {/if} {/if}
@@ -63,4 +128,21 @@ position: relative; overflow: hidden; } + + .collapse { + position: absolute; + bottom: 16px; + height: 40px; + width: 16px; + background: var(--theme-bg-2); + display: flex; + flex-direction: column; + justify-content: center; + } + + .collapse:hover { + color: var(--theme-font-hover); + background: var(--theme-bg-3); + cursor: pointer; + } diff --git a/packages/web/src/elements/VerticalSplitter.svelte b/packages/web/src/elements/VerticalSplitter.svelte index 55bc7c17..bc3f0186 100644 --- a/packages/web/src/elements/VerticalSplitter.svelte +++ b/packages/web/src/elements/VerticalSplitter.svelte @@ -41,7 +41,7 @@ {/if} {/if} - {#if allowCollapseChild1 && !collapsed2} + {#if allowCollapseChild1 && !collapsed2 && isSplitter} {#if collapsed1}
- +