From 3efc31f0048787a17b97ea34a863a2586fb703cc Mon Sep 17 00:00:00 2001 From: MAPS Marketing Date: Tue, 26 Sep 2023 09:43:22 +1000 Subject: [PATCH] Replaced the position absolutes with flex instead --- src/navigator/view/ItemView.ts | 46 ++++++++++++--------- src/styles/scss/_gjs_layers.scss | 69 +++++++++++++++++--------------- 2 files changed, 64 insertions(+), 51 deletions(-) diff --git a/src/navigator/view/ItemView.ts b/src/navigator/view/ItemView.ts index a56bc4a23..cadec048b 100644 --- a/src/navigator/view/ItemView.ts +++ b/src/navigator/view/ItemView.ts @@ -42,11 +42,12 @@ export default class ItemView extends View { const { hidable } = config; const count = module.getComponents(model).length; const addClass = !count ? this.clsNoChild : ''; + const clsItem = `${pfx}layer-item ${ppfx}one-bg`; const clsTitle = `${this.clsTitle} ${addClass}`; - const clsTitleC = `${this.clsTitleC} ${ppfx}one-bg`; + const clsTitleC = `${this.clsTitleC}`; const clsInput = `${this.inputNameCls} ${clsNoEdit} ${ppfx}no-app`; const level = opt.level + 1; - const gut = `${30 + level * 10}px`; + const gut = `${10 + level * 10}px`; const name = model.getName(); const icon = model.getIcon(); const clsBase = `${pfx}layer`; @@ -54,26 +55,33 @@ export default class ItemView extends View { const { move, eye, eyeOff, chevron } = icons!; return ` - ${ - hidable - ? ` - ${eye} - ${eyeOff} - ` - : '' - } -
-
-
- ${chevron} - ${icon ? `${icon}` : ''} - ${name} +
+
+ ${ + hidable + ? ` + ${eye} + ${eyeOff} + ` + : '' + } +
+
+
+ ${chevron} + ${icon ? `${icon}` : ''} + ${name} +
+
+
+ ${count ? `
${count || ''}
` : ''} +
${move || ''}
+
-
${count || ''}
-
${move || ''}
-
`; +
+ `; } public get em(): EditorModel { diff --git a/src/styles/scss/_gjs_layers.scss b/src/styles/scss/_gjs_layers.scss index 0b1292534..ed0456cc9 100644 --- a/src/styles/scss/_gjs_layers.scss +++ b/src/styles/scss/_gjs_layers.scss @@ -1,5 +1,4 @@ $layerIconSize: 15px !default; -$layerNameSpacing: 5px !default; .#{$nv-prefix} { &selected-parent { @@ -18,26 +17,39 @@ $layerNameSpacing: 5px !default; font-size: $fontSizeS; display: grid; - &-hidden { - @include opacity(0.55); + &-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 5px 10px; + + &-left, + &-right { + display: flex; + align-items: center; + gap: 10px; + } + + &-left { + width: 100%; + } } - &-count { - position: absolute; - right: 27px; - top: 9px; + &-hidden { + @include opacity(0.55); } &-vis { - left: 0; - top: 0; - padding: 7px 5px 7px 10px; - position: absolute; box-sizing: content-box; cursor: pointer; - width: 13px; z-index: 1; + &-on, + &-off { + display: flex; + width: 13px; + } + &-off { display: none; } @@ -54,35 +66,36 @@ $layerNameSpacing: 5px !default; &-caret { width: 15px; - padding: 2px; cursor: pointer; - position: absolute; box-sizing: content-box; - left: -15px; - top: 0; transform: rotate(90deg); @include opacity(0.7); &:hover { @include opacity(1); } + } - &.#{$nv-prefix}layer-open { + &.open > &-item &-caret { transform: rotate(180deg); - } } &-title { @extend .#{$app-prefix}category-title; - padding: 3px 10px 5px 30px; + padding: 0; display: flex; align-items: center; + background-color: transparent !important; &-inn { align-items: center; position: relative; display: flex; + gap: 5px; + } + + &-c { width: 100%; } } @@ -100,13 +113,10 @@ $layerNameSpacing: 5px !default; } &-name { - padding: $layerNameSpacing 0; display: inline-block; box-sizing: content-box; - overflow: hidden; - white-space: nowrap; - margin: 0 30px 0 $layerNameSpacing; max-width: 170px; + height: auto; @extend .#{$app-prefix}no-user-select; &--no-edit { @@ -127,26 +137,21 @@ $layerNameSpacing: 5px !default; } &-move { - padding: 9px 7px; - position: absolute; width: 13px; box-sizing: content-box; cursor: move; - right: 0; - top: 0; } - &.#{$nv-prefix}hovered .#{$nv-prefix}layer-title { - background-color: rgba(255, 255, 255, 0.015); + &.#{$nv-prefix}hovered .#{$nv-prefix}layer-item { + background-color: rgba(255, 255, 255, 0.15); } - &.#{$nv-prefix}selected .#{$nv-prefix}layer-title { - background-color: rgba(255, 255, 255, 0.1); + &.#{$nv-prefix}selected .#{$nv-prefix}layer-item { + background-color: rgba(255, 255, 255, 0.3); } } } - .#{$app-prefix}layers { position: relative; height: 100%;