From 7c0c029582811bccaf66cbc9e6a0454e32f1a654 Mon Sep 17 00:00:00 2001 From: arjxn-py Date: Fri, 27 Sep 2024 14:09:29 +0530 Subject: [PATCH] Fix typing failures --- packages/base/src/3dview/helpers.ts | 2 +- packages/base/src/3dview/mainview.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/base/src/3dview/helpers.ts b/packages/base/src/3dview/helpers.ts index c8f279fe..a519a6d7 100644 --- a/packages/base/src/3dview/helpers.ts +++ b/packages/base/src/3dview/helpers.ts @@ -36,7 +36,7 @@ export const SELECTED_MESH_COLOR = new THREE.Color( export type BasicMesh = THREE.Mesh< THREE.BufferGeometry, - THREE.MeshBasicMaterial + THREE.MeshBasicMaterial | THREE.MeshPhongMaterial >; /** diff --git a/packages/base/src/3dview/mainview.tsx b/packages/base/src/3dview/mainview.tsx index c62850c8..35a24459 100644 --- a/packages/base/src/3dview/mainview.tsx +++ b/packages/base/src/3dview/mainview.tsx @@ -287,7 +287,7 @@ export class MainView extends React.Component { this._model.syncCamera( { position: this._camera.position.toArray([]), - rotation: this._camera.rotation.toArray([]), + rotation: [this._camera.rotation.x, this._camera.rotation.y, this._camera.rotation.z], up: this._camera.up.toArray([]) }, this._mainViewModel.id @@ -382,10 +382,11 @@ export class MainView extends React.Component { this.divRef.current.clientHeight, false ); - if (this._camera.type === 'PerspectiveCamera') { + if (this._camera instanceof THREE.PerspectiveCamera) { this._camera.aspect = this.divRef.current.clientWidth / this.divRef.current.clientHeight; - } else { + } + else if (this._camera instanceof THREE.OrthographicCamera) { this._camera.left = this.divRef.current.clientWidth / -2; this._camera.right = this.divRef.current.clientWidth / 2; this._camera.top = this.divRef.current.clientHeight / 2; @@ -821,6 +822,9 @@ export class MainView extends React.Component { pos.postShape = exported as any; resolve(); }, + () => { + // Intentionally empty: no error handling needed for this case + }, // Empty function to handle errors options ); });