Skip to content

Commit

Permalink
feat: add stop method (#536)
Browse files Browse the repository at this point in the history
* feat: add stop method

* docs
  • Loading branch information
yomotsu authored Aug 17, 2024
1 parent 359b6f6 commit f9c6131
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions src/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9c6131

Please sign in to comment.