Просмотр исходного кода

Inspector: Fix Timeline resize

sunag 2 недель назад
Родитель
Сommit
c1889da3c4
2 измененных файлов с 15 добавлено и 4 удалено
  1. 13 2
      examples/jsm/inspector/tabs/Timeline.js
  2. 2 2
      examples/jsm/inspector/ui/Profiler.js

+ 13 - 2
examples/jsm/inspector/tabs/Timeline.js

@@ -63,7 +63,7 @@ class Timeline extends Tab {
 		// Bind window resize to update graph bounds
 		window.addEventListener( 'resize', () => {
 
-			if ( ! this.isRecording && this.frames.length > 0 ) {
+			if ( this.isActive && ! this.isRecording && this.frames.length > 0 ) {
 
 				this.renderSlider();
 
@@ -79,7 +79,7 @@ class Timeline extends Tab {
 
 		this.profiler.addEventListener( 'resize', () => {
 
-			if ( ! this.isRecording && this.frames.length > 0 ) {
+			if ( this.isActive && ! this.isRecording && this.frames.length > 0 ) {
 
 				this.renderSlider();
 
@@ -89,6 +89,17 @@ class Timeline extends Tab {
 
 	}
 
+	setActive( isActive ) {
+
+		super.setActive( isActive );
+
+		if ( isActive && ! this.isRecording && this.frames.length > 0 ) {
+
+			this.renderSlider();
+
+		}
+
+	}
 
 	buildHeader() {
 

+ 2 - 2
examples/jsm/inspector/ui/Profiler.js

@@ -1530,6 +1530,8 @@ export class Profiler extends EventDispatcher {
 
 				}
 
+				this.dispatchEvent( { type: 'resize' } );
+
 			};
 
 			const onResizeEnd = () => {
@@ -1686,8 +1688,6 @@ export class Profiler extends EventDispatcher {
 
 		}
 
-
-
 		this.dispatchEvent( { type: 'resize' } );
 
 		this.saveLayout();

粤ICP备19079148号