|
@@ -50,7 +50,7 @@
|
|
|
*/
|
|
|
|
|
|
|
|
|
- class ArcballControls extends THREE.Object3D {
|
|
|
+ class ArcballControls extends THREE.EventDispatcher {
|
|
|
|
|
|
constructor( _camera, domElement, scene = null ) {
|
|
|
|
|
@@ -464,11 +464,11 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.applyTransformMatrix( this.applyScale( size, scalePoint ) );
|
|
|
+ this.applyTransformMatrix( this.scale( size, scalePoint ) );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -541,7 +541,7 @@
|
|
|
const newDistance = y / Math.tan( THREE.MathUtils.DEG2RAD * ( newFov / 2 ) );
|
|
|
size = x / newDistance;
|
|
|
this.setFov( newFov );
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._gizmos.position, false ) );
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position, false ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -859,7 +859,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -928,7 +928,7 @@
|
|
|
this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
|
|
|
|
|
|
this.setFov( newFov );
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._v3_2, false ) ); //adjusting distance
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); //adjusting distance
|
|
|
|
|
|
const direction = this._gizmos.position.clone().sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
|
|
|
|
|
@@ -1216,7 +1216,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.applyTransformMatrix( this.applyScale( amount, scalePoint ) );
|
|
|
+ this.applyTransformMatrix( this.scale( amount, scalePoint ) );
|
|
|
this.dispatchEvent( _changeEvent );
|
|
|
|
|
|
}
|
|
@@ -1320,7 +1320,7 @@
|
|
|
this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
|
|
|
|
|
|
this.setFov( newFov );
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._v3_2, false ) ); //adjusting distance
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); //adjusting distance
|
|
|
|
|
|
const direction = this._gizmos.position.clone().sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
|
|
|
|
|
@@ -1635,7 +1635,7 @@
|
|
|
|
|
|
if ( this.enableZoom ) {
|
|
|
|
|
|
- this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
|
|
|
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2160,7 +2160,7 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.applyScale = ( size, point, scaleGizmos = true ) => {
|
|
|
+ this.scale = ( size, point, scaleGizmos = true ) => {
|
|
|
|
|
|
const scalePoint = point.clone();
|
|
|
let sizeInverse = 1 / size;
|
|
@@ -2585,7 +2585,7 @@
|
|
|
if ( this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom ) {
|
|
|
|
|
|
const newZoom = THREE.MathUtils.clamp( this.camera.zoom, this.minZoom, this.maxZoom );
|
|
|
- this.applyTransformMatrix( this.applyScale( newZoom / this.camera.zoom, this._gizmos.position, true ) );
|
|
|
+ this.applyTransformMatrix( this.scale( newZoom / this.camera.zoom, this._gizmos.position, true ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2597,7 +2597,7 @@
|
|
|
if ( distance > this.maxDistance + EPS || distance < this.minDistance - EPS ) {
|
|
|
|
|
|
const newDistance = THREE.MathUtils.clamp( distance, this.minDistance, this.maxDistance );
|
|
|
- this.applyTransformMatrix( this.applyScale( newDistance / distance, this._gizmos.position ) );
|
|
|
+ this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) );
|
|
|
this.updateMatrixState();
|
|
|
|
|
|
} //check fov
|
|
@@ -2932,21 +2932,19 @@
|
|
|
this.dispatchEvent( _changeEvent );
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 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 curve = new THREE.EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
|
|
|
const points = curve.getPoints( this._curvePts );
|
|
|
- const curveGeometry = new BufferGeometry().setFromPoints( points );
|
|
|
-
|
|
|
+ const curveGeometry = new THREE.BufferGeometry().setFromPoints( points );
|
|
|
|
|
|
for ( const gizmo in this._gizmos.children ) {
|
|
|
|
|
@@ -2957,8 +2955,6 @@
|
|
|
this.dispatchEvent( _changeEvent );
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* Creates the rotation gizmos matching trackball center and radius
|
|
|
* @param {Vector3} tbCenter The trackball center
|