Browse Source

EditorControls: Reverted zoom behaviour.
Now that we have focus() it makes more sense.

Mr.doob 12 years ago
parent
commit
c27f3499ef
1 changed files with 14 additions and 2 deletions
  1. 14 2
      examples/js/controls/EditorControls.js

+ 14 - 2
examples/js/controls/EditorControls.js

@@ -50,6 +50,18 @@ THREE.EditorControls = function ( object, domElement ) {
 
 	};
 
+	this.zoom = function ( distance ) {
+
+		normalMatrix.getNormalMatrix( this.object.matrix );
+
+		distance.applyMatrix3( normalMatrix );
+
+		this.object.position.add( distance );
+
+		this.dispatchEvent( changeEvent );
+
+	};
+
 	this.rotate = function ( delta ) {
 
 		var position = this.object.position;
@@ -119,7 +131,7 @@ THREE.EditorControls = function ( object, domElement ) {
 
 		} else if ( state === STATE.ZOOM ) {
 
-			scope.pan( new THREE.Vector3( 0, 0, movementY ) );
+			scope.zoom( new THREE.Vector3( 0, 0, movementY ) );
 
 		} else if ( state === STATE.PAN ) {
 
@@ -156,7 +168,7 @@ THREE.EditorControls = function ( object, domElement ) {
 
 		}
 
-		scope.pan( new THREE.Vector3( 0, 0, delta ) );
+		scope.zoom( new THREE.Vector3( 0, 0, delta ) );
 
 	}