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

Editor: Fixed sidebar glitch via h scrollable #28467

Merged
merged 6 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion editor/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,38 @@ textarea, input { outline: none; } /* osx */

.TabbedPanel .Tabs {
position: relative;
z-index: 1; /** Above .Panels **/
display: block;
width: 100%;
white-space: pre;
overflow: hidden;
overflow-x: auto;
}

.TabbedPanel .Tabs::-webkit-scrollbar {
height: 5px;
background: #eee;
}
.TabbedPanel .Tabs::-webkit-scrollbar-thumb {
background: #08f3;
}
.TabbedPanel .Tabs:hover::-webkit-scrollbar-thumb {
background: #08f;
cursor: ew-resize;
}

.TabbedPanel .Tabs .Tab {
padding: 10px 9px;
text-transform: uppercase;
}

.TabbedPanel .Tabs .Tab:last-child {
margin-right: 22px;
}

.TabbedPanel .Panels {
position: relative;
position: absolute;
top: 40px;
display: block;
width: 100%;
}
Expand Down Expand Up @@ -296,6 +317,7 @@ select {

#resizer {
position: absolute;
z-index: 2; /* Above #sidebar */
top: 32px;
right: 350px;
width: 5px;
Expand Down Expand Up @@ -463,6 +485,7 @@ select {
width: 350px;
background: #eee;
overflow: auto;
overflow-x: hidden;
}

#sidebar .Panel {
Expand Down Expand Up @@ -732,6 +755,10 @@ select {
border-top: 1px solid #222;
}

.TabbedPanel .Tabs::-webkit-scrollbar {
background: #222;
}

.TabbedPanel .Tab {
color: #555;
border-right: 1px solid #222;
Expand Down
3 changes: 3 additions & 0 deletions editor/js/Sidebar.Properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ function SidebarProperties( editor ) {
if ( container.selected === 'geometryTab' ) {

container.select( geometryTab.isHidden() ? 'objectTab' : 'geometryTab' );
geometryTab.dom.scrollIntoView( { inline: 'center', behavior: 'smooth' } );

} else if ( container.selected === 'materialTab' ) {

container.select( materialTab.isHidden() ? 'objectTab' : 'materialTab' );
materialTab.dom.scrollIntoView( { inline: 'center', behavior: 'smooth' } );

} else if ( container.selected === 'scriptTab' ) {

container.select( scriptTab.isHidden() ? 'objectTab' : 'scriptTab' );
scriptTab.dom.scrollIntoView( { inline: 'center', behavior: 'smooth' } );

}

Expand Down
1 change: 1 addition & 0 deletions editor/js/libs/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ class UITabbedPanel extends UIDiv {
if ( tab ) {

tab.addClass( 'selected' );
tab.dom.scrollIntoView( { inline: 'center', behavior: 'smooth' } );
Copy link
Owner

Choose a reason for hiding this comment

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

That's nice! I didn't know about this 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

congrats 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that there's an issue when using scrollIntoView in the editor, and its solved by using scrollTo instead, see #28485 🙏🏻 sorry for that.


}

Expand Down