File tree Expand file tree Collapse file tree 6 files changed +22
-9
lines changed Expand file tree Collapse file tree 6 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,17 @@ export class DebugLayer {
386386 }
387387 }
388388
389+ /**
390+ * Get the number of opened panes in the inspector
391+ */
392+ public get openedPanes ( ) {
393+ if ( this . BJSINSPECTOR ) {
394+ return this . BJSINSPECTOR . Inspector . _OpenedPane ;
395+ }
396+
397+ return 0 ;
398+ }
399+
389400 /**
390401 * Update the scene in the inspector
391402 */
Original file line number Diff line number Diff line change @@ -582,6 +582,10 @@ export class Inspector {
582582 this . _GlobalState . onSceneExplorerClosedObservable . notifyObservers ( ) ;
583583 }
584584
585+ if ( this . _EmbedHostWindow && ! this . _EmbedHostWindow . closed ) {
586+ this . _EmbedHostWindow . close ( ) ;
587+ }
588+
585589 Inspector . _OpenedPane = 0 ;
586590 this . _Cleanup ( ) ;
587591
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export class CommandBarComponent extends React.Component<ICommandBarComponentPro
8080 }
8181
8282 onInspector ( ) {
83- this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ! this . props . globalState . inspectorIsOpened ) ;
83+ this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ) ;
8484 }
8585
8686 onExamples ( ) {
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export class HamburgerMenuComponent extends React.Component<IHamburgerMenuCompon
5959 }
6060
6161 onInspector ( ) {
62- this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ! this . props . globalState . inspectorIsOpened ) ;
62+ this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ) ;
6363 this . setState ( { isExpanded : false } ) ;
6464 }
6565
Original file line number Diff line number Diff line change @@ -50,19 +50,18 @@ export class RenderingComponent extends React.Component<IRenderingComponentProps
5050 this . _downloadManager . download ( this . _engine ) ;
5151 } ) ;
5252
53- this . props . globalState . onInspectorRequiredObservable . add ( ( state ) => {
53+ this . props . globalState . onInspectorRequiredObservable . add ( ( ) => {
5454 if ( ! this . _scene ) {
5555 return ;
5656 }
5757
58- if ( state ) {
58+ if ( this . _scene . debugLayer . openedPanes === 0 ) {
5959 this . _scene . debugLayer . show ( {
6060 embedMode : true ,
6161 } ) ;
6262 } else {
6363 this . _scene . debugLayer . hide ( ) ;
6464 }
65- this . props . globalState . inspectorIsOpened = state ;
6665 } ) ;
6766
6867 this . props . globalState . onFullcreenRequiredObservable . add ( ( ) => {
@@ -359,7 +358,7 @@ export class RenderingComponent extends React.Component<IRenderingComponentProps
359358 }
360359
361360 if ( this . _engine . scenes [ 0 ] && displayInspector ) {
362- this . props . globalState . onInspectorRequiredObservable . notifyObservers ( true ) ;
361+ this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ) ;
363362 }
364363
365364 if ( checkCamera && this . _engine . scenes [ 0 ] . activeCamera == null ) {
@@ -370,7 +369,7 @@ export class RenderingComponent extends React.Component<IRenderingComponentProps
370369 } else if ( globalObject . scene . then ) {
371370 globalObject . scene . then ( ( ) => {
372371 if ( this . _engine ! . scenes [ 0 ] && displayInspector ) {
373- this . props . globalState . onInspectorRequiredObservable . notifyObservers ( true ) ;
372+ this . props . globalState . onInspectorRequiredObservable . notifyObservers ( ) ;
374373 }
375374 } ) ;
376375 } else {
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ export class GlobalState {
3131 public mobileDefaultMode = EditionMode . RenderingOnly ;
3232
3333 public runtimeMode = RuntimeMode . Editor ;
34- public inspectorIsOpened = false ;
3534
3635 public currentSnippetTitle = "" ;
3736 public currentSnippetDescription = "" ;
@@ -55,7 +54,7 @@ export class GlobalState {
5554 public onMetadataUpdatedObservable = new Observable < void > ( ) ;
5655 public onMetadataWindowHiddenObservable = new Observable < boolean > ( ) ;
5756 public onDownloadRequiredObservable = new Observable < void > ( ) ;
58- public onInspectorRequiredObservable = new Observable < boolean > ( ) ;
57+ public onInspectorRequiredObservable = new Observable < void > ( ) ;
5958 public onFormatCodeRequiredObservable = new Observable < void > ( ) ;
6059 public onFullcreenRequiredObservable = new Observable < void > ( ) ;
6160 public onEditorFullcreenRequiredObservable = new Observable < void > ( ) ;
You can’t perform that action at this time.
0 commit comments