Skip to content

Commit d33b929

Browse files
authored
Set the arcball rotate speed (#26332)
* Be able to set the arcball rotate speed * Add rotateSpeed option to documentation - lexically sort documented properties --------- Co-authored-by: Bernd Meyer <[email protected]>
1 parent d6f3887 commit d33b929

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docs/examples/en/controls/ArcballControls.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@ <h3>[property:Float minZoom]</h3>
186186
How far you can zoom in ( [page:OrthographicCamera] only ). Default is 0.
187187
</p>
188188

189+
<h3>[property:Float radiusFactor]</h3>
190+
<p>
191+
The size of the gizmo relative to the screen width and height. Default is 0.67.
192+
</p>
193+
194+
<h3>[property:Float rotateSpeed]</h3>
195+
<p>
196+
Speed of rotation. Default is 1.
197+
</p>
198+
189199
<h3>[property:Float scaleFactor]</h3>
190200
<p>
191201
The scaling factor used when performing zoom operation.
@@ -201,11 +211,6 @@ <h3>[property:Float wMax]</h3>
201211
Maximum angular velocity allowed on rotation animation start.
202212
</p>
203213

204-
<h3>[property:Float radiusFactor]</h3>
205-
<p>
206-
The size of the gizmo relative to the screen width and height. Default is 0.67.
207-
</p>
208-
209214

210215
<h2>Methods</h2>
211216

examples/jsm/controls/ArcballControls.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ class ArcballControls extends EventDispatcher {
199199
this.cursorZoom = false; //if wheel zoom should be cursor centered
200200
this.minFov = 5;
201201
this.maxFov = 90;
202+
this.rotateSpeed = 1;
202203

203204
this.enabled = true;
204205
this.enablePan = true;
@@ -445,7 +446,7 @@ class ArcballControls extends EventDispatcher {
445446

446447
const distance = this._startCursorPosition.distanceTo( this._currentCursorPosition );
447448
const angle = this._startCursorPosition.angleTo( this._currentCursorPosition );
448-
const amount = Math.max( distance / this._tbRadius, angle ); //effective rotation angle
449+
const amount = Math.max( distance / this._tbRadius, angle ) * this.rotateSpeed; //effective rotation angle
449450

450451
this.applyTransformMatrix( this.rotate( this.calculateRotationAxis( this._startCursorPosition, this._currentCursorPosition ), amount ) );
451452

0 commit comments

Comments
 (0)