提交 ba347be7 编写于 作者: M martinRenou 提交者: Mr.doob

Add attributes to EditorControls (#9819)

* Add attributes to EditorControls

Add attributes to EditorControls to be able to change speed of controls

* Changed attribute name factor to speed
上级 843e7338
......@@ -13,6 +13,9 @@ THREE.EditorControls = function ( object, domElement ) {
this.enabled = true;
this.center = new THREE.Vector3();
this.panSpeed = 0.001
this.zoomSpeed = 0.001
this.rotationSpeed = 0.005
// internals
......@@ -57,7 +60,7 @@ THREE.EditorControls = function ( object, domElement ) {
var distance = object.position.distanceTo( center );
delta.multiplyScalar( distance * 0.001 );
delta.multiplyScalar( distance * this.panSpeed );
delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
object.position.add( delta );
......@@ -71,7 +74,7 @@ THREE.EditorControls = function ( object, domElement ) {
var distance = object.position.distanceTo( center );
delta.multiplyScalar( distance * 0.001 );
delta.multiplyScalar( distance * this.zoomSpeed );
if ( delta.length() > distance ) return;
......@@ -144,7 +147,7 @@ THREE.EditorControls = function ( object, domElement ) {
if ( state === STATE.ROTATE ) {
scope.rotate( new THREE.Vector3( - movementX * 0.005, - movementY * 0.005, 0 ) );
scope.rotate( new THREE.Vector3( - movementX * this.rotationSpeed, - movementY * this.rotationSpeed, 0 ) );
} else if ( state === STATE.ZOOM ) {
......@@ -267,7 +270,7 @@ THREE.EditorControls = function ( object, domElement ) {
case 1:
touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 );
touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 );
scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 0.005 ) );
scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - this.rotationSpeed ) );
break;
case 2:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册