Skip to content

Commit

Permalink
fix: avoid using instanceof for three object (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
yomotsu authored May 30, 2024
1 parent cf39295 commit f75d1e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ export class CameraControls extends EventDispatcher {
fitToSphere( sphereOrMesh: _THREE.Sphere | _THREE.Object3D, enableTransition: boolean ): Promise<void[]> {

const promises: Promise<void>[] = [];
const isSphere = sphereOrMesh instanceof THREE.Sphere;
const isSphere = 'isSphere' in sphereOrMesh;
const boundingSphere = isSphere ?
_sphere.copy( sphereOrMesh as _THREE.Sphere ) :
CameraControls.createBoundingSphere( sphereOrMesh as _THREE.Object3D, _sphere );
Expand Down Expand Up @@ -2372,7 +2372,7 @@ export class CameraControls extends EventDispatcher {
*/
getSpherical( out: _THREE.Spherical, receiveEndValue: boolean = true ): _THREE.Spherical {

const _out = !! out && out instanceof THREE.Spherical ? out : new THREE.Spherical() as _THREE.Spherical;
const _out = out || new THREE.Spherical() as _THREE.Spherical;
return _out.copy( receiveEndValue ? this._sphericalEnd : this._spherical );

}
Expand Down

0 comments on commit f75d1e1

Please sign in to comment.