소스 검색

updates aspect ratio for all perspective cameras (#28425)

ycw 1 년 전
부모
커밋
a620f3f040
1개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  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();
+
+			}
+
+		}
 
 	}