|
@@ -52,28 +52,31 @@ THREE.EditorControls = function ( object, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.pan = function ( distance ) {
|
|
|
+ this.pan = function ( delta ) {
|
|
|
|
|
|
- normalMatrix.getNormalMatrix( object.matrix );
|
|
|
+ var distance = object.position.distanceTo( center );
|
|
|
|
|
|
- distance.applyMatrix3( normalMatrix );
|
|
|
- distance.multiplyScalar( vector.copy( center ).sub( object.position ).length() * 0.001 );
|
|
|
+ delta.multiplyScalar( distance * 0.001 );
|
|
|
+ delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
|
|
|
|
|
|
- object.position.add( distance );
|
|
|
- center.add( distance );
|
|
|
+ object.position.add( delta );
|
|
|
+ center.add( delta );
|
|
|
|
|
|
scope.dispatchEvent( changeEvent );
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.zoom = function ( distance ) {
|
|
|
+ this.zoom = function ( delta ) {
|
|
|
|
|
|
- normalMatrix.getNormalMatrix( object.matrix );
|
|
|
+ var distance = object.position.distanceTo( center );
|
|
|
|
|
|
- distance.applyMatrix3( normalMatrix );
|
|
|
- distance.multiplyScalar( vector.copy( center ).sub( object.position ).length() * 0.001 );
|
|
|
+ delta.multiplyScalar( distance * 0.001 );
|
|
|
|
|
|
- object.position.add( distance );
|
|
|
+ if ( delta.length() > distance ) return;
|
|
|
+
|
|
|
+ delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
|
|
|
+
|
|
|
+ object.position.add( delta );
|
|
|
|
|
|
scope.dispatchEvent( changeEvent );
|
|
|
|