From ac74d28d0e197d1cbeda94a989eff2843f0440aa Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 15 Dec 2021 11:28:28 +0100 Subject: [PATCH] ui: widget tree tweaks --- src/client/ui/ui-tree.js | 11 +++++++++-- src/scss/ui/tree.scss | 39 ++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/client/ui/ui-tree.js b/src/client/ui/ui-tree.js index 0d4ed0e2..0a80621f 100644 --- a/src/client/ui/ui-tree.js +++ b/src/client/ui/ui-tree.js @@ -59,12 +59,14 @@ class UiTree extends UiWidget { super(options) this.mounted = false - this.container.appendChild(html`
${raw(icon('exclamation-triangle'))} ${locales('fragment_mode_warning')}
`) this.filter = this.container.appendChild(html``) - this.list = this.container.appendChild(html`
    ${raw(icon('exclamation-triangle'))} ${locales('fragment_mode_warning')}`) + this.wrapper = this.container.appendChild(html`
    `) + this.list = this.wrapper.appendChild(html`
      ` this.deferredUpdateTimeout = null + this.expanded = {} this.init = false @@ -217,6 +219,7 @@ class UiTree extends UiWidget { parent = parent.parentNode } node[0].scrollIntoView({block: 'center'}) + this.wrapper.scrollLeft = (node[0].depth - 1) * 20 } if (this.parent.minimized) this.parent.restore() @@ -228,6 +231,7 @@ class UiTree extends UiWidget { DOM.each(this.list, '.editing', (el)=>{ el.classList.add('editor-blink') el.scrollIntoView({block: 'center'}) + this.wrapper.scrollLeft = (el.depth - 1) * 20 setTimeout(()=>{ el.classList.remove('editor-blink') }, 800) @@ -263,6 +267,9 @@ class UiTree extends UiWidget { data-widget="${widget.hash}" data-type="${widget.getProp('type')}"> ${raw(icon(widgetIcons[widget.getProp('type')] || 'root'))}${id}` + + node.depth = depth + if (widget instanceof Panel && !(widget instanceof Matrix || widget instanceof Keyboard)) { node.insertBefore(html``, node.childNodes[0]) node.classList.add('container') diff --git a/src/scss/ui/tree.scss b/src/scss/ui/tree.scss index 11a800e9..c6865056 100644 --- a/src/scss/ui/tree.scss +++ b/src/scss/ui/tree.scss @@ -5,14 +5,28 @@ $padding: 16rem; $line-height: 28rem; - padding: 0 $padding; + $field-height: 30rem; padding-right: 0; text-transform: none; line-height: $line-height; + display: flex; + flex-direction: column; + overflow: hidden; + + .tree { + width: 100%; + flex: 1; + position: relative; + overflow: auto; + padding-left:$padding; + padding-right:$padding; + + } ol { + list-style: none; position: relative; padding-left: 16rem; @@ -123,7 +137,7 @@ @include pseudo-fill($z: -1); &:after { left: calc(-1 * var(--depth) * 16rem - #{$padding}); - right: 1rem; + right: 1rem - $padding; bottom: auto; height: $line-height; top: 0; @@ -143,7 +157,7 @@ @include pseudo-fill($z: -1); &:after { left: calc(-1 * var(--depth) * 16rem - #{$padding}); - right: 1rem; + right: 1rem - $padding; bottom: auto; height: $line-height; opacity: 0.1; @@ -152,17 +166,14 @@ .filter { - margin-left: #{-$padding * 2}; - width: calc(100% + #{$padding * 2}); display: block; - background: linear-gradient(to right, var(--color-background), var(--color-ui-background)); font-family: $font; - line-height: $field-height - 4rem; - padding: 4rem $padding; - padding-left: #{$padding * 2}; - position: sticky; + line-height: $field-height; + padding: 0 $padding; top: 0; z-index: 2; + background: var(--color-ui-background-active); + border-bottom: 1rem solid var(--color-background); } .filter-active .filter-hide { @@ -170,12 +181,10 @@ } .fragment-mode-warning { - margin-left: #{-$padding * 2}; - width: calc(100% + #{$padding * 2}); color: var(--color-warning); - padding: 8rem $padding; - padding-left: #{$padding * 2}; - line-height: $field-height - 4rem; + padding: 0 $padding; + line-height: $field-height; + border-bottom: 1rem solid var(--color-background); display: none; }