فهرست منبع

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();
+
+			}
+
+		}
 
 	}