|
@@ -82,6 +82,7 @@ class ArcballControls extends EventDispatcher {
|
|
|
this.domElement = domElement;
|
|
|
this.scene = scene;
|
|
|
this.target = new Vector3( 0, 0, 0 );
|
|
|
+ this.radiusFactor = 0.67;
|
|
|
|
|
|
this.mouseActions = [];
|
|
|
this._mouseOp = null;
|
|
@@ -1976,18 +1977,17 @@ class ArcballControls extends EventDispatcher {
|
|
|
*/
|
|
|
calculateTbRadius = ( camera ) => {
|
|
|
|
|
|
- const factor = 0.67;
|
|
|
const distance = camera.position.distanceTo( this._gizmos.position );
|
|
|
|
|
|
if ( camera.type == 'PerspectiveCamera' ) {
|
|
|
|
|
|
const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5; //vertical fov/2 in radians
|
|
|
const halfFovH = Math.atan( ( camera.aspect ) * Math.tan( halfFovV ) ); //horizontal fov/2 in radians
|
|
|
- return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance * factor;
|
|
|
+ return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance * this.radiusFactor;
|
|
|
|
|
|
} else if ( camera.type == 'OrthographicCamera' ) {
|
|
|
|
|
|
- return Math.min( camera.top, camera.right ) * factor;
|
|
|
+ return Math.min( camera.top, camera.right ) * this.radiusFactor;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2243,6 +2243,30 @@ class ArcballControls extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Set gizmos radius factor and redraws gizmos
|
|
|
+ * @param {Float} value Value of radius factor
|
|
|
+ */
|
|
|
+ setTbRadius( value ) {
|
|
|
+
|
|
|
+ this.radiusFactor = value;
|
|
|
+ this._tbRadius = this.calculateTbRadius( this.camera );
|
|
|
+
|
|
|
+ const curve = new EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
|
|
|
+ const points = curve.getPoints( this._curvePts );
|
|
|
+ const curveGeometry = new BufferGeometry().setFromPoints( points );
|
|
|
+
|
|
|
+
|
|
|
+ for ( const gizmo in this._gizmos.children ) {
|
|
|
+
|
|
|
+ this._gizmos.children[ gizmo ].geometry = curveGeometry;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.dispatchEvent( _changeEvent );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Creates the rotation gizmos matching trackball center and radius
|
|
|
* @param {Vector3} tbCenter The trackball center
|