-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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: Hides irrelevant tabs for better ux #28287
Conversation
I think this could be done in a more clean way in this file: https://github.com/mrdoob/three.js/blob/dev/editor/js/Sidebar.Properties.js |
This reverts commit 3eb63a6.
Almost there... const objectTab = new SidebarObject( editor );
const geometryTab = new SidebarGeometry( editor );
const materialTab = new SidebarMaterial( editor );
const scriptTab = new SidebarScript( editor );
container.addTab( 'objectTab', strings.getKey( 'sidebar/properties/object' ), objectTab );
container.addTab( 'geometryTab', strings.getKey( 'sidebar/properties/geometry' ), geometryTab );
container.addTab( 'materialTab', strings.getKey( 'sidebar/properties/material' ), materialTab );
container.addTab( 'scriptTab', strings.getKey( 'sidebar/properties/script' ), scriptTab ); No need for |
so getTabByTabId is needed to get the tab, then hide/show based on selected object. |
d23df55
to
b6f2ba3
Compare
@@ -18,6 +18,54 @@ function SidebarProperties( editor ) { | |||
container.addTab( 'scriptTab', strings.getKey( 'sidebar/properties/script' ), new SidebarScript( editor ) ); | |||
container.select( 'objectTab' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! We probably do not need this line anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed for initializing, otherwise last option is selected, in our case the SCRIPT tab is picked by default.
If without this line, then:
- Examples>Arkanoid
- Select 'Ground' in outliner
- You should see active tab in properties is SCRIPT, not OBJECT <<
The PR hides irrelevant properties tabs for the actively selected object ... which is less confusing ... for example,
Scene
doesn't have geometry and material, so GEOMETRY and MATERIAL (tabs) should be hidden when it's being selected:hide_irrelevant.mp4
Preview: https://raw.githack.com/ycw/three.js/editor-hide-properties-tabbedpanel/editor/index.html