diff --git a/ts/components/HorizontalResizer.svelte b/ts/components/HorizontalResizer.svelte index c43af360e..218e9dc3b 100644 --- a/ts/components/HorizontalResizer.svelte +++ b/ts/components/HorizontalResizer.svelte @@ -3,6 +3,9 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -->
+ {#if showIndicator} +
+ +
+ {/if} +
{@html horizontalHandle}
@@ -99,7 +120,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html width: 100%; cursor: row-resize; position: relative; - height: 10px; + height: 25px; border-top: 1px solid var(--border); z-index: 20; @@ -113,5 +134,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html &:hover .drag-handle { opacity: 0.8; } + + .resize-indicator { + position: absolute; + font-size: small; + bottom: 0; + } + &.rtl .resize-indicator { + padding: 0.5rem 0 0 0.5rem; + right: 0; + } } diff --git a/ts/components/Pane.svelte b/ts/components/Pane.svelte index c291947ee..54d111cb0 100644 --- a/ts/components/Pane.svelte +++ b/ts/components/Pane.svelte @@ -59,5 +59,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html .pane { @include panes.resizable(column, true, true); + opacity: var(--opacity, 1); } diff --git a/ts/editor/NoteEditor.svelte b/ts/editor/NoteEditor.svelte index fe5f6f2e3..40ee1fdee 100644 --- a/ts/editor/NoteEditor.svelte +++ b/ts/editor/NoteEditor.svelte @@ -355,12 +355,28 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html $: tagAmount = $tags.length; + let snapTags = $tagsCollapsed; + function collapseTags(): void { lowerResizer.move([tagsPane, fieldsPane], tagsPane.minHeight); + $tagsCollapsed = snapTags = true; } function expandTags(): void { lowerResizer.move([tagsPane, fieldsPane], tagsPane.maxHeight); + $tagsCollapsed = snapTags = false; + } + + window.addEventListener("resize", () => snapResizer(snapTags)); + + function snapResizer(collapse: boolean): void { + if (collapse) { + collapseTags(); + bridgeCommand("collapseTags"); + } else { + expandTags(); + bridgeCommand("expandTags"); + } } @@ -390,7 +406,9 @@ the AddCards dialog) should be implemented in the user of this component. (fieldsPane.height = e.detail.height)} + on:resize={(e) => { + fieldsPane.height = e.detail.height; + }} > @@ -553,7 +571,17 @@ the AddCards dialog) should be implemented in the user of this component. - {#if $tagsCollapsed} + snapResizer(!$tagsCollapsed)} + on:release={() => { + snapResizer(snapTags); + }} + >
{ @@ -564,36 +592,28 @@ the AddCards dialog) should be implemented in the user of this component. {@html tagAmount > 0 ? `${tagAmount} Tags` : ""}
- {/if} - - { - if ($tagsCollapsed) { - expandTags(); - bridgeCommand("expandTags"); - $tagsCollapsed = false; - } else { - collapseTags(); - bridgeCommand("collapseTags"); - $tagsCollapsed = true; - } - }} - /> + { tagsPane.height = e.detail.height; - $tagsCollapsed = tagsPane.height == 0; + if (tagsPane.maxHeight > 0) { + snapTags = tagsPane.height < tagsPane.maxHeight / 2; + } }} + --opacity={(() => { + if (!$tagsCollapsed) { + return 1; + } else { + return snapTags ? tagsPane.height / tagsPane.maxHeight : 1; + } + })()} > { @@ -617,7 +637,4 @@ the AddCards dialog) should be implemented in the user of this component. flex-direction: column; height: 100%; } - .tags-expander { - margin-top: 0.5rem; - } diff --git a/ts/tag-editor/tag-options-button/TagOptionsButton.svelte b/ts/tag-editor/tag-options-button/TagOptionsButton.svelte index b6f39040b..69ad34ee6 100644 --- a/ts/tag-editor/tag-options-button/TagOptionsButton.svelte +++ b/ts/tag-editor/tag-options-button/TagOptionsButton.svelte @@ -25,6 +25,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html