Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add stop method #536

Merged
merged 2 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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