Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced the position absolutes with flex instead in Layers view #5422

Merged
merged 5 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 27 additions & 19 deletions src/navigator/view/ItemView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,46 @@ 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`;
const { icons } = em?.getConfig();
const { move, eye, eyeOff, chevron } = icons!;

return `
${
hidable
? `<i class="${pfx}layer-vis" data-toggle-visible>
<i class="${pfx}layer-vis-on">${eye}</i>
<i class="${pfx}layer-vis-off">${eyeOff}</i>
</i>`
: ''
}
<div class="${clsTitleC}">
<div class="${clsTitle}" style="padding-left: ${gut}" data-toggle-select>
<div class="${pfx}layer-title-inn" title="${name}">
<i class="${this.clsCaret}" data-toggle-open>${chevron}</i>
${icon ? `<span class="${clsBase}__icon">${icon}</span>` : ''}
<span class="${clsInput}" data-name>${name}</span>
<div class="${clsItem}">
<div class="${pfx}layer-item-left">
${
hidable
? `<i class="${pfx}layer-vis" data-toggle-visible>
<i class="${pfx}layer-vis-on">${eye}</i>
<i class="${pfx}layer-vis-off">${eyeOff}</i>
</i>`
: ''
}
<div class="${clsTitleC}">
<div class="${clsTitle}" style="padding-left: ${gut}" data-toggle-select>
<div class="${pfx}layer-title-inn" title="${name}">
<i class="${this.clsCaret}" data-toggle-open>${chevron}</i>
${icon ? `<span class="${clsBase}__icon">${icon}</span>` : ''}
<span class="${clsInput}" data-name>${name}</span>
</div>
</div>
</div>
</div>
<div class="${pfx}layer-item-right">
${count ? `<div class="${this.clsCount}" data-count>${count || ''}</div>` : ''}
<div class="${this.clsMove}" data-toggle-move>${move || ''}</div>
</div>
</div>
<div class="${this.clsCount}" data-count>${count || ''}</div>
<div class="${this.clsMove}" data-toggle-move>${move || ''}</div>
<div class="${this.clsChildren}"></div>`;
<div class="${this.clsChildren}"></div>
`;
}

public get em(): EditorModel {
Expand Down
69 changes: 37 additions & 32 deletions src/styles/scss/_gjs_layers.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$layerIconSize: 15px !default;
$layerNameSpacing: 5px !default;

.#{$nv-prefix} {
&selected-parent {
Expand All @@ -18,26 +17,39 @@ $layerNameSpacing: 5px !default;
font-size: var(--gjs-font-size);
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;
}
Expand All @@ -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%;
}
}
Expand All @@ -100,13 +113,10 @@ $layerNameSpacing: 5px !default;
}

&-name {
padding: $layerNameSpacing 0;
display: inline-block;
box-sizing: content-box;
overflow: hidden;
white-space: nowrap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason behind removing these? Those properties are used to apply ellipsis to long layer names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much on your feedback @artf :)

It's dark-on-dark and I'm blind as a bat, so didn't see the border underneath :D Will fix this up and the CSS code for the ellipsis. I'll resubmit once I've got it updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @artf

I've made the requested fixes. Please let me know if you require anything further.

Thank you very much Artur

image

margin: 0 30px 0 $layerNameSpacing;
max-width: 170px;
height: auto;
@extend .#{$app-prefix}no-user-select;

&--no-edit {
Expand All @@ -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%;
Expand Down