Skip to content

Commit

Permalink
🐞 fix: Fix the bug where the camera does not update when the view siz…
Browse files Browse the repository at this point in the history
…e changes.
  • Loading branch information
xiangechen committed Aug 8, 2024
1 parent d479338 commit a560e76
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/chili-three/src/threeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit a560e76

Please sign in to comment.