From 92c0af20bd6e842504b2d17171f99c4495b0d0c2 Mon Sep 17 00:00:00 2001 From: Yomotsu Date: Sat, 17 Aug 2024 16:17:19 +0900 Subject: [PATCH 1/2] feat: add stop method --- readme.md | 4 ++++ src/CameraControls.ts | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/readme.md b/readme.md index 71aea7c..0916b07 100644 --- a/readme.md +++ b/readme.md @@ -655,6 +655,10 @@ Normalize camera azimuth angle rotation between 0 and 360 degrees. --- +#### `stop()` + +Cancel and stop all transitions. + #### `reset( enableTransition )` Reset all rotation and position to default. diff --git a/src/CameraControls.ts b/src/CameraControls.ts index ccb5396..fe749c7 100644 --- a/src/CameraControls.ts +++ b/src/CameraControls.ts @@ -2402,6 +2402,15 @@ export class CameraControls extends EventDispatcher { } + 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 From 6172cf459719dc9af8111b5d7500184ee5eb1e22 Mon Sep 17 00:00:00 2001 From: Yomotsu Date: Sat, 17 Aug 2024 16:21:20 +0900 Subject: [PATCH 2/2] docs --- readme.md | 12 ++++++------ src/CameraControls.ts | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 0916b07..e067a4a 100644 --- a/readme.md +++ b/readme.md @@ -643,21 +643,21 @@ Returns the focal offset, which is how much the camera appears to be translated --- -#### `saveState()` +#### `stop()` -Set current camera position as the default position +stop all transitions. --- -#### `normalizeRotations()` +#### `saveState()` -Normalize camera azimuth angle rotation between 0 and 360 degrees. +Set current camera position as the default position --- -#### `stop()` +#### `normalizeRotations()` -Cancel and stop all transitions. +Normalize camera azimuth angle rotation between 0 and 360 degrees. #### `reset( enableTransition )` diff --git a/src/CameraControls.ts b/src/CameraControls.ts index fe749c7..05f7498 100644 --- a/src/CameraControls.ts +++ b/src/CameraControls.ts @@ -2402,6 +2402,9 @@ export class CameraControls extends EventDispatcher { } + /** + * stop all transitions. + */ stop() { this._focalOffset.copy( this._focalOffsetEnd );