Skip to content

Commit

Permalink
add setters for angle and distance
Browse files Browse the repository at this point in the history
  • Loading branch information
yomotsu committed Apr 8, 2020
1 parent 3205a28 commit 98528d3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,20 +611,59 @@ export class CameraControls extends EventDispatcher {

}

set distance( distance ) {

if (
this._spherical.radius === distance &&
this._sphericalEnd.radius === distance
) return;

this._spherical.radius = distance;
this._sphericalEnd.radius = distance;
this._needsUpdate = true;

}

// horizontal angle
get azimuthAngle(): number {

return this._spherical.theta;

}

set azimuthAngle( azimuthAngle ) {

if (
this._spherical.theta === azimuthAngle &&
this._sphericalEnd.theta === azimuthAngle
) return;

this._spherical.theta = azimuthAngle;
this._sphericalEnd.theta = azimuthAngle;
this._needsUpdate = true;

}

// vertical angle
get polarAngle(): number {

return this._spherical.phi;

}

set polarAngle( polarAngle ) {

if (
this._spherical.phi === polarAngle &&
this._sphericalEnd.phi === polarAngle
) return;

this._spherical.phi = polarAngle;
this._sphericalEnd.phi = polarAngle;
this._needsUpdate = true;

}

// wrong. phi should be map to polar, but backward compatibility.
set phiSpeed( speed: number ) {

Expand Down

0 comments on commit 98528d3

Please sign in to comment.