Skip to content

Commit fde4b93

Browse files
authored
Inspector: Improve UX (#32197)
* improve ux * Tab: allowDetach * improve no-tabs ux * update z-index when resized * cleanup * restore original indexes
1 parent af5a82a commit fde4b93

File tree

8 files changed

+1920
-41
lines changed

8 files changed

+1920
-41
lines changed

examples/jsm/inspector/Inspector.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,22 @@ class Inspector extends RendererInspector {
5353
const performance = new Performance();
5454
profiler.addTab( performance );
5555

56-
const console = new Console();
57-
profiler.addTab( console );
56+
const consoleTab = new Console();
57+
profiler.addTab( consoleTab );
5858

59-
profiler.setActiveTab( performance.id );
59+
profiler.loadLayout();
6060

61-
//
61+
if ( ! profiler.activeTabId ) {
62+
63+
profiler.setActiveTab( performance.id );
64+
65+
}
6266

6367
this.statsData = new Map();
6468
this.canvasNodes = new Map();
6569
this.profiler = profiler;
6670
this.performance = performance;
67-
this.console = console;
71+
this.console = consoleTab;
6872
this.parameters = parameters;
6973
this.viewer = viewer;
7074
this.once = {};
@@ -200,7 +204,12 @@ class Inspector extends RendererInspector {
200204
if ( this.parameters.isVisible === false ) {
201205

202206
this.parameters.show();
203-
this.profiler.setActiveTab( this.parameters.id );
207+
208+
if ( this.parameters.isDetached === false ) {
209+
210+
this.profiler.setActiveTab( this.parameters.id );
211+
212+
}
204213

205214
}
206215

examples/jsm/inspector/tabs/Console.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Tab } from '../ui/Tab.js';
22

33
class Console extends Tab {
44

5-
constructor() {
5+
constructor( options = {} ) {
66

7-
super( 'Console' );
7+
super( 'Console', options );
88

99
this.filters = { info: true, warn: true, error: true };
1010
this.filterText = '';

examples/jsm/inspector/tabs/Parameters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ class ParametersGroup {
299299

300300
class Parameters extends Tab {
301301

302-
constructor() {
302+
constructor( options = {} ) {
303303

304-
super( 'Parameters' );
304+
super( 'Parameters', options );
305305

306306
const paramList = new List( 'Property', 'Value' );
307307
paramList.domElement.classList.add( 'parameters' );

examples/jsm/inspector/tabs/Performance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { createValueSpan, setText } from '../ui/utils.js';
66

77
class Performance extends Tab {
88

9-
constructor() {
9+
constructor( options = {} ) {
1010

11-
super( 'Performance' );
11+
super( 'Performance', options );
1212

1313
const perfList = new List( 'Name', 'CPU', 'GPU', 'Total' );
1414
perfList.setGridStyle( 'minmax(200px, 2fr) 80px 80px 80px' );

examples/jsm/inspector/tabs/Viewer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { RendererUtils, NoToneMapping, LinearSRGBColorSpace } from 'three/webgpu
66

77
class Viewer extends Tab {
88

9-
constructor() {
9+
constructor( options = {} ) {
1010

11-
super( 'Viewer' );
11+
super( 'Viewer', options );
1212

1313
const nodeList = new List( 'Viewer', 'Name' );
1414
nodeList.setGridStyle( '150px minmax(200px, 2fr)' );
15-
nodeList.domElement.style.minWidth = '600px';
15+
nodeList.domElement.style.minWidth = '400px';
1616

1717
const scrollWrapper = document.createElement( 'div' );
1818
scrollWrapper.className = 'list-scroll-wrapper';
@@ -70,7 +70,7 @@ class Viewer extends Tab {
7070

7171
update( renderer, canvasDataList ) {
7272

73-
if ( ! this.isActive ) return;
73+
if ( ! this.isActive && ! this.isDetached ) return;
7474

7575
//
7676

0 commit comments

Comments
 (0)