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

OrbitControls: Add keyRotateSpeed. #29988

Merged
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
5 changes: 5 additions & 0 deletions docs/examples/en/controls/OrbitControls.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ <h3>[property:Float keyPanSpeed]</h3>
How fast to pan the camera when the keyboard is used. Default is 7.0 pixels per keypress.
</p>

<h3>[property:Float keyRotateSpeed]</h3>
<p>
How fast to rotate the camera when the keyboard is used. Default is 1.
</p>

<h3>[property:Object keys]</h3>
<p>
This object contains references to the keycodes for controlling camera panning. Default is the 4 arrow keys.
Expand Down
9 changes: 5 additions & 4 deletions examples/jsm/controls/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class OrbitControls extends Controls {
// Set to false to disable rotating
this.enableRotate = true;
this.rotateSpeed = 1.0;
this.keyRotateSpeed = 1.0;

// Set to false to disable panning
this.enablePan = true;
Expand Down Expand Up @@ -786,7 +787,7 @@ class OrbitControls extends Controls {

if ( this.enableRotate ) {

this._rotateUp( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
this._rotateUp( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );

}

Expand All @@ -809,7 +810,7 @@ class OrbitControls extends Controls {

if ( this.enableRotate ) {

this._rotateUp( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
this._rotateUp( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );

}

Expand All @@ -832,7 +833,7 @@ class OrbitControls extends Controls {

if ( this.enableRotate ) {

this._rotateLeft( _twoPI * this.rotateSpeed / this.domElement.clientHeight );
this._rotateLeft( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );

}

Expand All @@ -855,7 +856,7 @@ class OrbitControls extends Controls {

if ( this.enableRotate ) {

this._rotateLeft( - _twoPI * this.rotateSpeed / this.domElement.clientHeight );
this._rotateLeft( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );

}

Expand Down