Browse Source

updates aspect ratio for all perspective cameras (#28425)

ycw 1 year ago
parent
commit
a620f3f040
1 changed files with 13 additions and 2 deletions
  1. 13 2
      editor/js/Viewport.js

+ 13 - 2
editor/js/Viewport.js

@@ -152,8 +152,19 @@ function Viewport( editor ) {
 
 	function updateAspectRatio() {
 
-		camera.aspect = container.dom.offsetWidth / container.dom.offsetHeight;
-		camera.updateProjectionMatrix();
+		for ( const uuid in editor.cameras ) {
+
+			const camera = editor.cameras[ uuid ];
+
+			if ( camera.isPerspectiveCamera ) {
+
+				camera.aspect = container.dom.offsetWidth / container.dom.offsetHeight;
+
+				camera.updateProjectionMatrix();
+
+			}
+
+		}
 
 	}