From f9c61319ac0e361a0ddff40967c1890011a92a08 Mon Sep 17 00:00:00 2001 From: Akihiro Oyamada Date: Sat, 17 Aug 2024 16:30:30 +0900 Subject: [PATCH] feat: add stop method (#536) * feat: add stop method * docs --- readme.md | 8 ++++++-- src/CameraControls.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 71aea7c..e067a4a 100644 --- a/readme.md +++ b/readme.md @@ -643,6 +643,12 @@ Returns the focal offset, which is how much the camera appears to be translated --- +#### `stop()` + +stop all transitions. + +--- + #### `saveState()` Set current camera position as the default position @@ -653,8 +659,6 @@ Set current camera position as the default position Normalize camera azimuth angle rotation between 0 and 360 degrees. ---- - #### `reset( enableTransition )` Reset all rotation and position to default. diff --git a/src/CameraControls.ts b/src/CameraControls.ts index ccb5396..05f7498 100644 --- a/src/CameraControls.ts +++ b/src/CameraControls.ts @@ -2402,6 +2402,18 @@ export class CameraControls extends EventDispatcher { } + /** + * stop all transitions. + */ + stop() { + + this._focalOffset.copy( this._focalOffsetEnd ); + this._target.copy( this._targetEnd ); + this._spherical.copy( this._sphericalEnd ); + this._zoom = this._zoomEnd; + + } + /** * Reset all rotation and position to defaults. * @param enableTransition