Browse Source

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]>
begmec 2 years ago
parent
commit
d33b929e2f

+ 10 - 5
docs/examples/en/controls/ArcballControls.html

@@ -186,6 +186,16 @@
 			How far you can zoom in ( [page:OrthographicCamera] only ). Default is 0.
 		</p>
 
+		<h3>[property:Float radiusFactor]</h3>
+		<p>
+			The size of the gizmo relative to the screen width and height. Default is 0.67.
+		</p>
+
+		<h3>[property:Float rotateSpeed]</h3>
+		<p>
+			Speed of rotation. Default is 1.
+		</p>
+
 		<h3>[property:Float scaleFactor]</h3>
 		<p>
 			The scaling factor used when performing zoom operation.
@@ -201,11 +211,6 @@
 			Maximum angular velocity allowed on rotation animation start.
 		</p>
 
-		<h3>[property:Float radiusFactor]</h3>
-		<p>
-			The size of the gizmo relative to the screen width and height. Default is 0.67.
-		</p>
-
 
 		<h2>Methods</h2>
 

+ 2 - 1
examples/jsm/controls/ArcballControls.js

@@ -199,6 +199,7 @@ class ArcballControls extends EventDispatcher {
 		this.cursorZoom = false;	//if wheel zoom should be cursor centered
 		this.minFov = 5;
 		this.maxFov = 90;
+		this.rotateSpeed = 1;
 
 		this.enabled = true;
 		this.enablePan = true;
@@ -445,7 +446,7 @@ class ArcballControls extends EventDispatcher {
 
 							const distance = this._startCursorPosition.distanceTo( this._currentCursorPosition );
 							const angle = this._startCursorPosition.angleTo( this._currentCursorPosition );
-							const amount = Math.max( distance / this._tbRadius, angle ); //effective rotation angle
+							const amount = Math.max( distance / this._tbRadius, angle ) * this.rotateSpeed; //effective rotation angle
 
 							this.applyTransformMatrix( this.rotate( this.calculateRotationAxis( this._startCursorPosition, this._currentCursorPosition ), amount ) );