From a560e763f50464576073f423345c948df2519989 Mon Sep 17 00:00:00 2001 From: xiange Date: Thu, 8 Aug 2024 20:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20Fix=20the=20bug=20where?= =?UTF-8?q?=20the=20camera=20does=20not=20update=20when=20the=20view=20siz?= =?UTF-8?q?e=20changes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/chili-three/src/threeView.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/chili-three/src/threeView.ts b/packages/chili-three/src/threeView.ts index f7438fac..ffcc57a3 100644 --- a/packages/chili-three/src/threeView.ts +++ b/packages/chili-three/src/threeView.ts @@ -178,14 +178,15 @@ export class ThreeView extends Observable implements IView { this._needsUpdate = false; } - resize(width: number, heigth: number) { + resize(width: number, height: number) { if (this.camera instanceof PerspectiveCamera) { - this.camera.aspect = width / heigth; + this.camera.aspect = width / height; this.camera.updateProjectionMatrix(); } else if (this.camera instanceof OrthographicCamera) { this.camera.updateProjectionMatrix(); } - this._renderer.setSize(width, heigth); + this._renderer.setSize(width, height); + this.cameraController.update(); this.update(); }