From c79ec57a5d922a6e533fe787a07fa81de948a98b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 18 Mar 2022 19:52:11 +0000 Subject: [PATCH] Add initial work on horizontally scrollable component tree with automatic scrolling --- .../src/components/common/NavItem.svelte | 75 ++++++++++--------- .../ComponentTree.svelte | 10 +++ .../ComponentNavigationTree/PathTree.svelte | 8 ++ .../ComponentNavigationTree/index.svelte | 7 +- .../FrontendNavigatePane.svelte | 66 +++++++++++++--- .../design/[assetType]/_layout.svelte | 2 - 6 files changed, 118 insertions(+), 50 deletions(-) diff --git a/packages/builder/src/components/common/NavItem.svelte b/packages/builder/src/components/common/NavItem.svelte index d2074b69b1..c653f4739a 100644 --- a/packages/builder/src/components/common/NavItem.svelte +++ b/packages/builder/src/components/common/NavItem.svelte @@ -15,6 +15,7 @@ export let iconColor const dispatch = createEventDispatcher() + let textRef function onIconClick(event) { event.stopPropagation() @@ -26,49 +27,58 @@ class="nav-item" class:border class:selected - style={`padding-left: ${indentLevel * 14}px`} + style={`padding-left: ${20 + indentLevel * 14}px`} {draggable} on:dragend on:dragstart on:dragover on:drop on:click + on:mouseover={() => { + const size = textRef.getBoundingClientRect() + dispatch("mouseover", size.width) + }} ondragover="return false" ondragenter="return false" > -
- {#if withArrow} -
- -
- {/if} + {#if withArrow} +
+ +
+ {/if} - - {#if iconText} -
- {iconText} -
- {:else if icon} -
- -
- {/if} -
{text}
- {#if withActions} -
- -
- {/if} -
+ + {#if iconText} +
+ {iconText} +
+ {:else if icon} +
+ +
+ {/if} +
{text}
+ {#if withActions} +
+ +
+ {/if} diff --git a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte index a5045d8e9f..12282323ee 100644 --- a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte @@ -1,5 +1,5 @@