Bläddra i källkod

OrbitControls: Reimplemented simpler version

WestLangley 9 år sedan
förälder
incheckning
ff4a4b59a9
1 ändrade filer med 507 tillägg och 740 borttagningar
  1. 507 740
      examples/js/controls/OrbitControls.js

+ 507 - 740
examples/js/controls/OrbitControls.js

@@ -5,1114 +5,881 @@
  * @author WestLangley / http://github.com/WestLangley
  * @author erich666 / http://erichaines.com
  */
-/*global THREE, console */
 
-( function () {
+// This set of controls performs orbiting, dollying (zooming), and panning. It maintains
+// the "up" direction as +Y, unlike the TrackballControls.
+//
+//    Orbit - left mouse / touch: one finger move
+//    Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
+//    Pan - right mouse, or arrow keys / touch: three finter swipe
 
-	function OrbitConstraint ( object ) {
+THREE.OrbitControls = function ( object, domElement ) {
 
-		this.object = object;
+	this.object = object;
+	this.domElement = ( domElement !== undefined ) ? domElement : document;
 
-		// "target" sets the location of focus, where the object orbits around
-		// and where it pans with respect to.
-		this.target = new THREE.Vector3();
+	// API - new
 
-		// Limits to how far you can dolly in and out ( PerspectiveCamera only )
-		this.minDistance = 0;
-		this.maxDistance = Infinity;
+	// Set to false to disable this control
+	this.enabled = true;
 
-		// Limits to how far you can zoom in and out ( OrthographicCamera only )
-		this.minZoom = 0;
-		this.maxZoom = Infinity;
+	// "target" sets the location of focus, where the object orbits around
+	// and where it pans with respect to.
+	this.target = new THREE.Vector3();
 
-		// How far you can orbit vertically, upper and lower limits.
-		// Range is 0 to Math.PI radians.
-		this.minPolarAngle = 0; // radians
-		this.maxPolarAngle = Math.PI; // radians
+	// center is old, deprecated; use "target" instead
+	this.center = this.target;
 
-		// How far you can orbit horizontally, upper and lower limits.
-		// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
-		this.minAzimuthAngle = - Infinity; // radians
-		this.maxAzimuthAngle = Infinity; // radians
+	// How far you can dolly in and out ( PerspectiveCamera only )
+	this.minDistance = 0;
+	this.maxDistance = Infinity;
 
-		// Set to true to enable damping (inertia)
-		// If damping is enabled, you must call controls.update() in your animation loop
-		this.enableDamping = false;
-		this.dampingFactor = 0.25;
+	// How far you can zoom in and out ( OrthographicCamera only )
+	this.minZoom = 0;
+	this.maxZoom = Infinity;
 
-		////////////
-		// internals
+	// How far you can orbit vertically, upper and lower limits.
+	// Range is 0 to Math.PI radians.
+	this.minPolarAngle = 0; // radians
+	this.maxPolarAngle = Math.PI; // radians
 
-		var scope = this;
+	// How far you can orbit horizontally, upper and lower limits.
+	// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
+	this.minAzimuthAngle = - Infinity; // radians
+	this.maxAzimuthAngle = Infinity; // radians
 
-		var EPS = 0.000001;
+	// Set to true to enable damping (inertia)
+	// If damping is enabled, you must call controls.update() in your animation loop
+	this.enableDamping = false;
+	this.dampingFactor = 0.25;
 
-		// Current position in spherical coordinate system.
-		var theta;
-		var phi;
+	// This option actually enables dollying in and out; left as "zoom" for
+	// backwards compatibility.
+	// Set to false to disable zooming
+	this.enableZoom = true;
+	this.zoomSpeed = 1.0;
 
-		// Pending changes
-		var phiDelta = 0;
-		var thetaDelta = 0;
-		var scale = 1;
-		var panOffset = new THREE.Vector3();
-		var zoomChanged = false;
+	// Set to false to disable rotating
+	this.enableRotate = true;
+	this.rotateSpeed = 1.0;
 
-		// API
+	// Set to false to disable panning
+	this.enablePan = true;
+	this.keyPanSpeed = 7.0;	// pixels moved per arrow key push
 
-		this.getPolarAngle = function () {
+	// Set to true to automatically rotate around the target
+	// If auto-rotate is enabled, you must call controls.update() in your animation loop
+	this.autoRotate = false;
+	this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
 
-			return phi;
+	// Set to false to disable use of the keys
+	this.enableKeys = true;
 
-		};
-
-		this.getAzimuthalAngle = function () {
-
-			return theta;
-
-		};
-
-		this.rotateLeft = function ( angle ) {
-
-			thetaDelta -= angle;
-
-		};
-
-		this.rotateUp = function ( angle ) {
-
-			phiDelta -= angle;
-
-		};
-
-		// pass in distance in world space to move left
-		this.panLeft = function() {
+	// The four arrow keys
+	this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
 
-			var v = new THREE.Vector3();
+	// Mouse buttons
+	this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
 
-			return function panLeft ( distance ) {
+	// for reset
+	this.target0 = this.target.clone();
+	this.position0 = this.object.position.clone();
+	this.zoom0 = this.object.zoom;
 
-				var te = this.object.matrix.elements;
+	// internals
 
-				// get X column of matrix
-				v.set( te[ 0 ], te[ 1 ], te[ 2 ] );
-				v.multiplyScalar( - distance );
+	var scope = this;
 
-				panOffset.add( v );
+	var EPS = 0.000001;
 
-			};
+	// Current position in spherical coordinate system.
+	var theta;
+	var phi;
 
-		}();
+	// Pending changes
+	var phiDelta = 0;
+	var thetaDelta = 0;
+	var scale = 1;
+	var panOffset = new THREE.Vector3();
+	var zoomChanged = false;
 
-		// pass in distance in world space to move up
-		this.panUp = function() {
+	var rotateStart = new THREE.Vector2();
+	var rotateEnd = new THREE.Vector2();
+	var rotateDelta = new THREE.Vector2();
 
-			var v = new THREE.Vector3();
+	var panStart = new THREE.Vector2();
+	var panEnd = new THREE.Vector2();
+	var panDelta = new THREE.Vector2();
 
-			return function panUp ( distance ) {
+	var dollyStart = new THREE.Vector2();
+	var dollyEnd = new THREE.Vector2();
+	var dollyDelta = new THREE.Vector2();
 
-				var te = this.object.matrix.elements;
+	var changeEvent = { type: 'change' };
+	var startEvent = { type: 'start' };
+	var endEvent = { type: 'end' };
 
-				// get Y column of matrix
-				v.set( te[ 4 ], te[ 5 ], te[ 6 ] );
-				v.multiplyScalar( distance );
+	var STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };
 
-				panOffset.add( v );
+	var state = STATE.NONE;
 
-			};
 
-		}();
-
-		// pass in x,y of change desired in pixel space,
-		// right and down are positive
-		this.pan = function ( deltaX, deltaY, screenWidth, screenHeight ) {
+	//
 
-			if ( scope.object instanceof THREE.PerspectiveCamera ) {
+	this.rotateLeft = function ( angle ) {
 
-				// perspective
-				var position = scope.object.position;
-				var offset = position.clone().sub( scope.target );
-				var targetDistance = offset.length();
+		//		if ( angle === undefined ) {
 
-				// half of the fov is center to top of screen
-				targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
+		//			angle = getAutoRotationAngle();
 
-				// we actually don't use screenWidth, since perspective camera is fixed to screen height
-				scope.panLeft( 2 * deltaX * targetDistance / screenHeight );
-				scope.panUp( 2 * deltaY * targetDistance / screenHeight );
+		//		}
 
-			} else if ( scope.object instanceof THREE.OrthographicCamera ) {
+		thetaDelta -= angle;
 
-				// orthographic
-				scope.panLeft( deltaX * ( scope.object.right - scope.object.left ) / screenWidth );
-				scope.panUp( deltaY * ( scope.object.top - scope.object.bottom ) / screenHeight );
+	};
 
-			} else {
+	this.rotateUp = function ( angle ) {
 
-				// camera neither orthographic or perspective
-				console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
+		//		if ( angle === undefined ) {
 
-			}
+		//			angle = getAutoRotationAngle();
 
-		};
+		//		}
 
-		this.dollyIn = function ( dollyScale ) {
+		phiDelta -= angle;
 
-			if ( scope.object instanceof THREE.PerspectiveCamera ) {
+	};
 
-				scale /= dollyScale;
+	// pass in distance in world space to move left
+	this.panLeft = function() {
 
-			} else if ( scope.object instanceof THREE.OrthographicCamera ) {
+		var v = new THREE.Vector3();
 
-				scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom * dollyScale ) );
-				scope.object.updateProjectionMatrix();
-				zoomChanged = true;
+		return function panLeft( distance ) {
 
-			} else {
+			var te = this.object.matrix.elements;
 
-				console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
+			// get X column of matrix
+			v.set( te[ 0 ], te[ 1 ], te[ 2 ] );
+			v.multiplyScalar( - distance );
 
-			}
+			panOffset.add( v );
 
 		};
 
-		this.dollyOut = function ( dollyScale ) {
+	}();
 
-			if ( scope.object instanceof THREE.PerspectiveCamera ) {
+	// pass in distance in world space to move up
+	this.panUp = function() {
 
-				scale *= dollyScale;
+		var v = new THREE.Vector3();
 
-			} else if ( scope.object instanceof THREE.OrthographicCamera ) {
+		return function panUp( distance ) {
 
-				scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / dollyScale ) );
-				scope.object.updateProjectionMatrix();
-				zoomChanged = true;
+			var te = this.object.matrix.elements;
 
-			} else {
+			// get Y column of matrix
+			v.set( te[ 4 ], te[ 5 ], te[ 6 ] );
+			v.multiplyScalar( distance );
 
-				console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
-
-			}
+			panOffset.add( v );
 
 		};
 
-		this.update = function() {
-
-			var offset = new THREE.Vector3();
-
-			// so camera.up is the orbit axis
-			var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
-			var quatInverse = quat.clone().inverse();
-
-			var lastPosition = new THREE.Vector3();
-			var lastQuaternion = new THREE.Quaternion();
-
-			return function () {
-
-				var position = this.object.position;
+	}();
 
-				offset.copy( position ).sub( this.target );
+	// pass in x,y of change desired in pixel space,
+	// right and down are positive
+	this.pan = function ( deltaX, deltaY /*, screenWidth, screenHeight */ ) {
 
-				// rotate offset to "y-axis-is-up" space
-				offset.applyQuaternion( quat );
+		var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
 
-				// angle from z-axis around y-axis
+		if ( scope.object instanceof THREE.PerspectiveCamera ) {
 
-				theta = Math.atan2( offset.x, offset.z );
+			// perspective
+			var position = scope.object.position;
+			var offset = position.clone().sub( scope.target );
+			var targetDistance = offset.length();
 
-				// angle from y-axis
+			// half of the fov is center to top of screen
+			targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
 
-				phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
+			// we actually don't use screenWidth, since perspective camera is fixed to screen height
+			scope.panLeft( 2 * deltaX * targetDistance / element.clientHeight );
+			scope.panUp( 2 * deltaY * targetDistance / element.clientHeight );
 
-				theta += thetaDelta;
-				phi += phiDelta;
+		} else if ( scope.object instanceof THREE.OrthographicCamera ) {
 
-				// restrict theta to be between desired limits
-				theta = Math.max( this.minAzimuthAngle, Math.min( this.maxAzimuthAngle, theta ) );
+			// orthographic
+			scope.panLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth );
+			scope.panUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight );
 
-				// restrict phi to be between desired limits
-				phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) );
+		} else {
 
-				// restrict phi to be betwee EPS and PI-EPS
-				phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
+			// camera neither orthographic or perspective
+			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
 
-				var radius = offset.length() * scale;
-
-				// restrict radius to be between desired limits
-				radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) );
-
-				// move target to panned location
-				this.target.add( panOffset );
-
-				offset.x = radius * Math.sin( phi ) * Math.sin( theta );
-				offset.y = radius * Math.cos( phi );
-				offset.z = radius * Math.sin( phi ) * Math.cos( theta );
-
-				// rotate offset back to "camera-up-vector-is-up" space
-				offset.applyQuaternion( quatInverse );
-
-				position.copy( this.target ).add( offset );
-
-				this.object.lookAt( this.target );
-
-				if ( this.enableDamping === true ) {
-
-					thetaDelta *= ( 1 - this.dampingFactor );
-					phiDelta *= ( 1 - this.dampingFactor );
-
-				} else {
-
-					thetaDelta = 0;
-					phiDelta = 0;
-
-				}
-
-				scale = 1;
-				panOffset.set( 0, 0, 0 );
-
-				// update condition is:
-				// min(camera displacement, camera rotation in radians)^2 > EPS
-				// using small-angle approximation cos(x/2) = 1 - x^2 / 8
-
-				if ( zoomChanged ||
-					 lastPosition.distanceToSquared( this.object.position ) > EPS ||
-				    8 * ( 1 - lastQuaternion.dot( this.object.quaternion ) ) > EPS ) {
-
-					lastPosition.copy( this.object.position );
-					lastQuaternion.copy( this.object.quaternion );
-					zoomChanged = false;
-
-					return true;
-
-				}
-
-				return false;
-
-			};
-
-		}();
+		}
 
 	};
 
+	this.dollyIn = function ( dollyScale ) {
 
-	// This set of controls performs orbiting, dollying (zooming), and panning. It maintains
-	// the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is
-	// supported.
-	//
-	//    Orbit - left mouse / touch: one finger move
-	//    Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
-	//    Pan - right mouse, or arrow keys / touch: three finter swipe
-
-	THREE.OrbitControls = function ( object, domElement ) {
-
-		var constraint = new OrbitConstraint( object );
-
-		this.domElement = ( domElement !== undefined ) ? domElement : document;
+		if ( scope.object instanceof THREE.PerspectiveCamera ) {
 
-		// API
+			scale /= dollyScale;
 
-		Object.defineProperty( this, 'constraint', {
+		} else if ( scope.object instanceof THREE.OrthographicCamera ) {
 
-			get: function() {
-
-				return constraint;
-
-			}
+			scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom * dollyScale ) );
+			scope.object.updateProjectionMatrix();
+			zoomChanged = true;
 
-		} );
+		} else {
 
-		this.getPolarAngle = function () {
+			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
 
-			return constraint.getPolarAngle();
-
-		};
-
-		this.getAzimuthalAngle = function () {
-
-			return constraint.getAzimuthalAngle();
-
-		};
-
-		// Set to false to disable this control
-		this.enabled = true;
-
-		// center is old, deprecated; use "target" instead
-		this.center = this.target;
-
-		// This option actually enables dollying in and out; left as "zoom" for
-		// backwards compatibility.
-		// Set to false to disable zooming
-		this.enableZoom = true;
-		this.zoomSpeed = 1.0;
+		}
 
-		// Set to false to disable rotating
-		this.enableRotate = true;
-		this.rotateSpeed = 1.0;
+	};
 
-		// Set to false to disable panning
-		this.enablePan = true;
-		this.keyPanSpeed = 7.0;	// pixels moved per arrow key push
+	this.dollyOut = function ( dollyScale ) {
 
-		// Set to true to automatically rotate around the target
-		// If auto-rotate is enabled, you must call controls.update() in your animation loop
-		this.autoRotate = false;
-		this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
+		if ( scope.object instanceof THREE.PerspectiveCamera ) {
 
-		// Set to false to disable use of the keys
-		this.enableKeys = true;
+			scale *= dollyScale;
 
-		// The four arrow keys
-		this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
+		} else if ( scope.object instanceof THREE.OrthographicCamera ) {
 
-		// Mouse buttons
-		this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
+			scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / dollyScale ) );
+			scope.object.updateProjectionMatrix();
+			zoomChanged = true;
 
-		////////////
-		// internals
+		} else {
 
-		var scope = this;
+			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
 
-		var rotateStart = new THREE.Vector2();
-		var rotateEnd = new THREE.Vector2();
-		var rotateDelta = new THREE.Vector2();
+		}
 
-		var panStart = new THREE.Vector2();
-		var panEnd = new THREE.Vector2();
-		var panDelta = new THREE.Vector2();
+	};
 
-		var dollyStart = new THREE.Vector2();
-		var dollyEnd = new THREE.Vector2();
-		var dollyDelta = new THREE.Vector2();
+	this.update = function() {
 
-		var STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };
+		var offset = new THREE.Vector3();
 
-		var state = STATE.NONE;
+		// so camera.up is the orbit axis
+		var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
+		var quatInverse = quat.clone().inverse();
 
-		// for reset
+		var lastPosition = new THREE.Vector3();
+		var lastQuaternion = new THREE.Quaternion();
 
-		this.target0 = this.target.clone();
-		this.position0 = this.object.position.clone();
-		this.zoom0 = this.object.zoom;
+		return function () {
 
-		// events
+			var position = this.object.position;
 
-		var changeEvent = { type: 'change' };
-		var startEvent = { type: 'start' };
-		var endEvent = { type: 'end' };
+			offset.copy( position ).sub( this.target );
 
-		// pass in x,y of change desired in pixel space,
-		// right and down are positive
-		function pan( deltaX, deltaY ) {
+			// rotate offset to "y-axis-is-up" space
+			offset.applyQuaternion( quat );
 
-			var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+			// angle from z-axis around y-axis
 
-			constraint.pan( deltaX, deltaY, element.clientWidth, element.clientHeight );
+			theta = Math.atan2( offset.x, offset.z );
 
-		}
+			// angle from y-axis
 
-		this.update = function () {
+			phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
 
 			if ( this.autoRotate && state === STATE.NONE ) {
 
-				constraint.rotateLeft( getAutoRotationAngle() );
-
-			}
-
-			if ( constraint.update() === true ) {
-
-				this.dispatchEvent( changeEvent );
+				this.rotateLeft( getAutoRotationAngle() );
 
 			}
 
-		};
-
-		this.reset = function () {
-
-			state = STATE.NONE;
-
-			this.target.copy( this.target0 );
-			this.object.position.copy( this.position0 );
-			this.object.zoom = this.zoom0;
-
-			this.object.updateProjectionMatrix();
-			this.dispatchEvent( changeEvent );
-
-			this.update();
-
-		};
-
-		function getAutoRotationAngle() {
-
-			return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
-
-		}
-
-		function getZoomScale() {
-
-			return Math.pow( 0.95, scope.zoomSpeed );
-
-		}
+			theta += thetaDelta;
+			phi += phiDelta;
 
-		function onMouseDown( event ) {
+			// restrict theta to be between desired limits
+			theta = Math.max( this.minAzimuthAngle, Math.min( this.maxAzimuthAngle, theta ) );
 
-			if ( scope.enabled === false ) return;
+			// restrict phi to be between desired limits
+			phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) );
 
-			event.preventDefault();
+			// restrict phi to be betwee EPS and PI-EPS
+			phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
 
-			if ( event.button === scope.mouseButtons.ORBIT ) {
+			var radius = offset.length() * scale;
 
-				if ( scope.enableRotate === false ) return;
+			// restrict radius to be between desired limits
+			radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) );
 
-				state = STATE.ROTATE;
+			// move target to panned location
+			this.target.add( panOffset );
 
-				rotateStart.set( event.clientX, event.clientY );
+			offset.x = radius * Math.sin( phi ) * Math.sin( theta );
+			offset.y = radius * Math.cos( phi );
+			offset.z = radius * Math.sin( phi ) * Math.cos( theta );
 
-			} else if ( event.button === scope.mouseButtons.ZOOM ) {
+			// rotate offset back to "camera-up-vector-is-up" space
+			offset.applyQuaternion( quatInverse );
 
-				if ( scope.enableZoom === false ) return;
+			position.copy( this.target ).add( offset );
 
-				state = STATE.DOLLY;
+			this.object.lookAt( this.target );
 
-				dollyStart.set( event.clientX, event.clientY );
+			if ( this.enableDamping === true ) {
 
-			} else if ( event.button === scope.mouseButtons.PAN ) {
+				thetaDelta *= ( 1 - this.dampingFactor );
+				phiDelta *= ( 1 - this.dampingFactor );
 
-				if ( scope.enablePan === false ) return;
-
-				state = STATE.PAN;
-
-				panStart.set( event.clientX, event.clientY );
-
-			}
-
-			if ( state !== STATE.NONE ) {
+			} else {
 
-				document.addEventListener( 'mousemove', onMouseMove, false );
-				document.addEventListener( 'mouseup', onMouseUp, false );
-				document.addEventListener( 'mouseout', onMouseUp, false );
-				scope.dispatchEvent( startEvent );
+				thetaDelta = 0;
+				phiDelta = 0;
 
 			}
 
-		}
-
-		function onMouseMove( event ) {
-
-			if ( scope.enabled === false ) return;
+			scale = 1;
+			panOffset.set( 0, 0, 0 );
 
-			event.preventDefault();
+			// update condition is:
+			// min(camera displacement, camera rotation in radians)^2 > EPS
+			// using small-angle approximation cos(x/2) = 1 - x^2 / 8
 
-			var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+			if ( zoomChanged ||
+				lastPosition.distanceToSquared( this.object.position ) > EPS ||
+				8 * ( 1 - lastQuaternion.dot( this.object.quaternion ) ) > EPS ) {
 
-			if ( state === STATE.ROTATE ) {
+				this.dispatchEvent( changeEvent );
 
-				if ( scope.enableRotate === false ) return;
+				lastPosition.copy( this.object.position );
+				lastQuaternion.copy( this.object.quaternion );
+				zoomChanged = false;
 
-				rotateEnd.set( event.clientX, event.clientY );
-				rotateDelta.subVectors( rotateEnd, rotateStart );
+				return true;
 
-				// rotating across whole screen goes 360 degrees around
-				constraint.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
+			}
 
-				// rotating up and down along whole screen attempts to go 360, but limited to 180
-				constraint.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
+			return false;
 
-				rotateStart.copy( rotateEnd );
+		};
 
-			} else if ( state === STATE.DOLLY ) {
+	}();
 
-				if ( scope.enableZoom === false ) return;
 
-				dollyEnd.set( event.clientX, event.clientY );
-				dollyDelta.subVectors( dollyEnd, dollyStart );
+	this.reset = function () {
 
-				if ( dollyDelta.y > 0 ) {
+		state = STATE.NONE;
 
-					constraint.dollyIn( getZoomScale() );
+		this.target.copy( this.target0 );
+		this.object.position.copy( this.position0 );
+		this.object.zoom = this.zoom0;
 
-				} else if ( dollyDelta.y < 0 ) {
+		this.object.updateProjectionMatrix();
+		this.dispatchEvent( changeEvent );
 
-					constraint.dollyOut( getZoomScale() );
+		this.update();
 
-				}
+	};
 
-				dollyStart.copy( dollyEnd );
+	this.getPolarAngle = function () {
 
-			} else if ( state === STATE.PAN ) {
+		return phi;
 
-				if ( scope.enablePan === false ) return;
+	};
 
-				panEnd.set( event.clientX, event.clientY );
-				panDelta.subVectors( panEnd, panStart );
+	this.getAzimuthalAngle = function () {
 
-				pan( panDelta.x, panDelta.y );
+		return theta
 
-				panStart.copy( panEnd );
+	};
 
-			}
+	function getAutoRotationAngle() {
 
-			if ( state !== STATE.NONE ) scope.update();
+		return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
 
-		}
+	}
 
-		function onMouseUp( /* event */ ) {
+	function getZoomScale() {
 
-			if ( scope.enabled === false ) return;
+		return Math.pow( 0.95, scope.zoomSpeed );
 
-			document.removeEventListener( 'mousemove', onMouseMove, false );
-			document.removeEventListener( 'mouseup', onMouseUp, false );
-			document.removeEventListener( 'mouseout', onMouseUp, false );
-			scope.dispatchEvent( endEvent );
-			state = STATE.NONE;
+	}
 
-		}
+	function onMouseDown( event ) {
 
-		function onMouseWheel( event ) {
+		if ( scope.enabled === false ) return;
 
-			if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
+		event.preventDefault();
 
-			event.preventDefault();
-			event.stopPropagation();
+		if ( event.button === scope.mouseButtons.ORBIT ) {
 
-			var delta = 0;
+			if ( scope.enableRotate === false ) return;
 
-			if ( event.wheelDelta !== undefined ) {
+			state = STATE.ROTATE;
 
-				// WebKit / Opera / Explorer 9
+			rotateStart.set( event.clientX, event.clientY );
 
-				delta = event.wheelDelta;
+		} else if ( event.button === scope.mouseButtons.ZOOM ) {
 
-			} else if ( event.detail !== undefined ) {
+			if ( scope.enableZoom === false ) return;
 
-				// Firefox
+			state = STATE.DOLLY;
 
-				delta = - event.detail;
+			dollyStart.set( event.clientX, event.clientY );
 
-			}
+		} else if ( event.button === scope.mouseButtons.PAN ) {
 
-			if ( delta > 0 ) {
+			if ( scope.enablePan === false ) return;
 
-				constraint.dollyOut( getZoomScale() );
+			state = STATE.PAN;
 
-			} else if ( delta < 0 ) {
+			panStart.set( event.clientX, event.clientY );
 
-				constraint.dollyIn( getZoomScale() );
+		}
 
-			}
+		if ( state !== STATE.NONE ) {
 
-			scope.update();
+			document.addEventListener( 'mousemove', onMouseMove, false );
+			document.addEventListener( 'mouseup', onMouseUp, false );
+			document.addEventListener( 'mouseout', onMouseUp, false );
 			scope.dispatchEvent( startEvent );
-			scope.dispatchEvent( endEvent );
 
 		}
 
-		function onKeyDown( event ) {
-
-			if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
+	}
 
-			switch ( event.keyCode ) {
+	function onMouseMove( event ) {
 
-				case scope.keys.UP:
-					pan( 0, scope.keyPanSpeed );
-					scope.update();
-					break;
+		if ( scope.enabled === false ) return;
 
-				case scope.keys.BOTTOM:
-					pan( 0, - scope.keyPanSpeed );
-					scope.update();
-					break;
+		event.preventDefault();
 
-				case scope.keys.LEFT:
-					pan( scope.keyPanSpeed, 0 );
-					scope.update();
-					break;
+		var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
 
-				case scope.keys.RIGHT:
-					pan( - scope.keyPanSpeed, 0 );
-					scope.update();
-					break;
+		if ( state === STATE.ROTATE ) {
 
-			}
-
-		}
-
-		function touchstart( event ) {
-
-			if ( scope.enabled === false ) return;
-
-			switch ( event.touches.length ) {
-
-				case 1:	// one-fingered touch: rotate
-
-					if ( scope.enableRotate === false ) return;
+			if ( scope.enableRotate === false ) return;
 
-					state = STATE.TOUCH_ROTATE;
+			rotateEnd.set( event.clientX, event.clientY );
+			rotateDelta.subVectors( rotateEnd, rotateStart );
 
-					rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-					break;
+			// rotating across whole screen goes 360 degrees around
+			scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
 
-				case 2:	// two-fingered touch: dolly
+			// rotating up and down along whole screen attempts to go 360, but limited to 180
+			scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
 
-					if ( scope.enableZoom === false ) return;
+			rotateStart.copy( rotateEnd );
 
-					state = STATE.TOUCH_DOLLY;
+		} else if ( state === STATE.DOLLY ) {
 
-					var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
-					var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
-					var distance = Math.sqrt( dx * dx + dy * dy );
-					dollyStart.set( 0, distance );
-					break;
+			if ( scope.enableZoom === false ) return;
 
-				case 3: // three-fingered touch: pan
+			dollyEnd.set( event.clientX, event.clientY );
+			dollyDelta.subVectors( dollyEnd, dollyStart );
 
-					if ( scope.enablePan === false ) return;
+			if ( dollyDelta.y > 0 ) {
 
-					state = STATE.TOUCH_PAN;
+				scope.dollyIn( getZoomScale() );
 
-					panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-					break;
+			} else if ( dollyDelta.y < 0 ) {
 
-				default:
-
-					state = STATE.NONE;
+				scope.dollyOut( getZoomScale() );
 
 			}
 
-			if ( state !== STATE.NONE ) scope.dispatchEvent( startEvent );
-
-		}
-
-		function touchmove( event ) {
-
-			if ( scope.enabled === false ) return;
-
-			event.preventDefault();
-			event.stopPropagation();
-
-			var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+			dollyStart.copy( dollyEnd );
 
-			switch ( event.touches.length ) {
+		} else if ( state === STATE.PAN ) {
 
-				case 1: // one-fingered touch: rotate
+			if ( scope.enablePan === false ) return;
 
-					if ( scope.enableRotate === false ) return;
-					if ( state !== STATE.TOUCH_ROTATE ) return;
+			panEnd.set( event.clientX, event.clientY );
+			panDelta.subVectors( panEnd, panStart );
 
-					rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-					rotateDelta.subVectors( rotateEnd, rotateStart );
+			scope.pan( panDelta.x, panDelta.y );
 
-					// rotating across whole screen goes 360 degrees around
-					constraint.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
-					// rotating up and down along whole screen attempts to go 360, but limited to 180
-					constraint.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
+			panStart.copy( panEnd );
 
-					rotateStart.copy( rotateEnd );
-
-					scope.update();
-					break;
-
-				case 2: // two-fingered touch: dolly
-
-					if ( scope.enableZoom === false ) return;
-					if ( state !== STATE.TOUCH_DOLLY ) return;
-
-					var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
-					var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
-					var distance = Math.sqrt( dx * dx + dy * dy );
-
-					dollyEnd.set( 0, distance );
-					dollyDelta.subVectors( dollyEnd, dollyStart );
-
-					if ( dollyDelta.y > 0 ) {
-
-						constraint.dollyOut( getZoomScale() );
-
-					} else if ( dollyDelta.y < 0 ) {
-
-						constraint.dollyIn( getZoomScale() );
-
-					}
-
-					dollyStart.copy( dollyEnd );
-
-					scope.update();
-					break;
+		}
 
-				case 3: // three-fingered touch: pan
+		if ( state !== STATE.NONE ) scope.update();
 
-					if ( scope.enablePan === false ) return;
-					if ( state !== STATE.TOUCH_PAN ) return;
+	}
 
-					panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-					panDelta.subVectors( panEnd, panStart );
+	function onMouseUp( /* event */ ) {
 
-					pan( panDelta.x, panDelta.y );
+		if ( scope.enabled === false ) return;
 
-					panStart.copy( panEnd );
+		document.removeEventListener( 'mousemove', onMouseMove, false );
+		document.removeEventListener( 'mouseup', onMouseUp, false );
+		document.removeEventListener( 'mouseout', onMouseUp, false );
+		scope.dispatchEvent( endEvent );
+		state = STATE.NONE;
 
-					scope.update();
-					break;
+	}
 
-				default:
+	function onMouseWheel( event ) {
 
-					state = STATE.NONE;
+		if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
 
-			}
+		event.preventDefault();
+		event.stopPropagation();
 
-		}
+		var delta = 0;
 
-		function touchend( /* event */ ) {
+		if ( event.wheelDelta !== undefined ) {
 
-			if ( scope.enabled === false ) return;
+			// WebKit / Opera / Explorer 9
 
-			scope.dispatchEvent( endEvent );
-			state = STATE.NONE;
+			delta = event.wheelDelta;
 
-		}
+		} else if ( event.detail !== undefined ) {
 
-		function contextmenu( event ) {
+			// Firefox
 
-			event.preventDefault();
+			delta = - event.detail;
 
 		}
 
-		this.dispose = function() {
-
-			this.domElement.removeEventListener( 'contextmenu', contextmenu, false );
-			this.domElement.removeEventListener( 'mousedown', onMouseDown, false );
-			this.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );
-			this.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox
+		if ( delta > 0 ) {
 
-			this.domElement.removeEventListener( 'touchstart', touchstart, false );
-			this.domElement.removeEventListener( 'touchend', touchend, false );
-			this.domElement.removeEventListener( 'touchmove', touchmove, false );
+			scope.dollyOut( getZoomScale() );
 
-			document.removeEventListener( 'mousemove', onMouseMove, false );
-			document.removeEventListener( 'mouseup', onMouseUp, false );
-			document.removeEventListener( 'mouseout', onMouseUp, false );
+		} else if ( delta < 0 ) {
 
-			window.removeEventListener( 'keydown', onKeyDown, false );
+			scope.dollyIn( getZoomScale() );
 
 		}
 
-		this.domElement.addEventListener( 'contextmenu', contextmenu, false );
-
-		this.domElement.addEventListener( 'mousedown', onMouseDown, false );
-		this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
-		this.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox
-
-		this.domElement.addEventListener( 'touchstart', touchstart, false );
-		this.domElement.addEventListener( 'touchend', touchend, false );
-		this.domElement.addEventListener( 'touchmove', touchmove, false );
-
-		window.addEventListener( 'keydown', onKeyDown, false );
-
-		// force an update at start
-		this.update();
-
-	};
-
-	THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
-	THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;
-
-	Object.defineProperties( THREE.OrbitControls.prototype, {
-
-		object: {
-
-			get: function () {
-
-				return this.constraint.object;
-
-			}
+		scope.update();
+		scope.dispatchEvent( startEvent );
+		scope.dispatchEvent( endEvent );
 
-		},
+	}
 
-		target: {
+	function onKeyDown( event ) {
 
-			get: function () {
+		if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
 
-				return this.constraint.target;
+		switch ( event.keyCode ) {
 
-			},
+			case scope.keys.UP:
+				scope.pan( 0, scope.keyPanSpeed );
+				scope.update();
+				break;
 
-			set: function ( value ) {
+			case scope.keys.BOTTOM:
+				scope.pan( 0, - scope.keyPanSpeed );
+				scope.update();
+				break;
 
-				console.warn( 'THREE.OrbitControls: target is now immutable. Use target.set() instead.' );
-				this.constraint.target.copy( value );
+			case scope.keys.LEFT:
+				scope.pan( scope.keyPanSpeed, 0 );
+				scope.update();
+				break;
 
-			}
+			case scope.keys.RIGHT:
+				scope.pan( - scope.keyPanSpeed, 0 );
+				scope.update();
+				break;
 
-		},
+		}
 
-		minDistance : {
+	}
 
-			get: function () {
+	function touchstart( event ) {
 
-				return this.constraint.minDistance;
+		if ( scope.enabled === false ) return;
 
-			},
+		switch ( event.touches.length ) {
 
-			set: function ( value ) {
+			case 1:	// one-fingered touch: rotate
 
-				this.constraint.minDistance = value;
+				if ( scope.enableRotate === false ) return;
 
-			}
+				state = STATE.TOUCH_ROTATE;
 
-		},
+				rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+				break;
 
-		maxDistance : {
+			case 2:	// two-fingered touch: dolly
 
-			get: function () {
+				if ( scope.enableZoom === false ) return;
 
-				return this.constraint.maxDistance;
+				state = STATE.TOUCH_DOLLY;
 
-			},
+				var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
+				var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
+				var distance = Math.sqrt( dx * dx + dy * dy );
+				dollyStart.set( 0, distance );
+				break;
 
-			set: function ( value ) {
+			case 3: // three-fingered touch: pan
 
-				this.constraint.maxDistance = value;
+				if ( scope.enablePan === false ) return;
 
-			}
+				state = STATE.TOUCH_PAN;
 
-		},
+				panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+				break;
 
-		minZoom : {
+			default:
 
-			get: function () {
+				state = STATE.NONE;
 
-				return this.constraint.minZoom;
+		}
 
-			},
+		if ( state !== STATE.NONE ) scope.dispatchEvent( startEvent );
 
-			set: function ( value ) {
+	}
 
-				this.constraint.minZoom = value;
+	function touchmove( event ) {
 
-			}
+		if ( scope.enabled === false ) return;
 
-		},
+		event.preventDefault();
+		event.stopPropagation();
 
-		maxZoom : {
+		var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
 
-			get: function () {
+		switch ( event.touches.length ) {
 
-				return this.constraint.maxZoom;
+			case 1: // one-fingered touch: rotate
 
-			},
+				if ( scope.enableRotate === false ) return;
+				if ( state !== STATE.TOUCH_ROTATE ) return;
 
-			set: function ( value ) {
+				rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+				rotateDelta.subVectors( rotateEnd, rotateStart );
 
-				this.constraint.maxZoom = value;
+				// rotating across whole screen goes 360 degrees around
+				scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
+				// rotating up and down along whole screen attempts to go 360, but limited to 180
+				scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
 
-			}
+				rotateStart.copy( rotateEnd );
 
-		},
+				scope.update();
+				break;
 
-		minPolarAngle : {
+			case 2: // two-fingered touch: dolly
 
-			get: function () {
+				if ( scope.enableZoom === false ) return;
+				if ( state !== STATE.TOUCH_DOLLY ) return;
 
-				return this.constraint.minPolarAngle;
+				var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
+				var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
+				var distance = Math.sqrt( dx * dx + dy * dy );
 
-			},
+				dollyEnd.set( 0, distance );
+				dollyDelta.subVectors( dollyEnd, dollyStart );
 
-			set: function ( value ) {
+				if ( dollyDelta.y > 0 ) {
 
-				this.constraint.minPolarAngle = value;
+					scope.dollyOut( getZoomScale() );
 
-			}
+				} else if ( dollyDelta.y < 0 ) {
 
-		},
+					scope.dollyIn( getZoomScale() );
 
-		maxPolarAngle : {
+				}
 
-			get: function () {
+				dollyStart.copy( dollyEnd );
 
-				return this.constraint.maxPolarAngle;
+				scope.update();
+				break;
 
-			},
+			case 3: // three-fingered touch: pan
 
-			set: function ( value ) {
+				if ( scope.enablePan === false ) return;
+				if ( state !== STATE.TOUCH_PAN ) return;
 
-				this.constraint.maxPolarAngle = value;
+				panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+				panDelta.subVectors( panEnd, panStart );
 
-			}
+				scope.pan( panDelta.x, panDelta.y );
 
-		},
+				panStart.copy( panEnd );
 
-		minAzimuthAngle : {
+				scope.update();
+				break;
 
-			get: function () {
+			default:
 
-				return this.constraint.minAzimuthAngle;
+				state = STATE.NONE;
 
-			},
+		}
 
-			set: function ( value ) {
+	}
 
-				this.constraint.minAzimuthAngle = value;
+	function touchend( /* event */ ) {
 
-			}
+		if ( scope.enabled === false ) return;
 
-		},
+		scope.dispatchEvent( endEvent );
+		state = STATE.NONE;
 
-		maxAzimuthAngle : {
+	}
 
-			get: function () {
+	function contextmenu( event ) {
 
-				return this.constraint.maxAzimuthAngle;
+		event.preventDefault();
 
-			},
+	}
 
-			set: function ( value ) {
+	this.dispose = function() {
 
-				this.constraint.maxAzimuthAngle = value;
+		this.domElement.removeEventListener( 'contextmenu', contextmenu, false );
+		this.domElement.removeEventListener( 'mousedown', onMouseDown, false );
+		this.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );
+		this.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox
 
-			}
+		this.domElement.removeEventListener( 'touchstart', touchstart, false );
+		this.domElement.removeEventListener( 'touchend', touchend, false );
+		this.domElement.removeEventListener( 'touchmove', touchmove, false );
 
-		},
+		document.removeEventListener( 'mousemove', onMouseMove, false );
+		document.removeEventListener( 'mouseup', onMouseUp, false );
+		document.removeEventListener( 'mouseout', onMouseUp, false );
 
-		enableDamping : {
+		window.removeEventListener( 'keydown', onKeyDown, false );
 
-			get: function () {
+	}
 
-				return this.constraint.enableDamping;
+	this.domElement.addEventListener( 'contextmenu', contextmenu, false );
 
-			},
+	this.domElement.addEventListener( 'mousedown', onMouseDown, false );
+	this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
+	this.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox
 
-			set: function ( value ) {
+	this.domElement.addEventListener( 'touchstart', touchstart, false );
+	this.domElement.addEventListener( 'touchend', touchend, false );
+	this.domElement.addEventListener( 'touchmove', touchmove, false );
 
-				this.constraint.enableDamping = value;
+	window.addEventListener( 'keydown', onKeyDown, false );
 
-			}
+	// force an update at start
+	this.update();
 
-		},
 
-		dampingFactor : {
+};
 
-			get: function () {
+THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
+THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;
 
-				return this.constraint.dampingFactor;
+Object.defineProperties( THREE.OrbitControls.prototype, {
 
-			},
+	// backward compatibility
 
-			set: function ( value ) {
+	noZoom: {
 
-				this.constraint.dampingFactor = value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+			return ! this.enableZoom;
 
 		},
 
-		// backward compatibility
-
-		noZoom: {
+		set: function ( value ) {
 
-			get: function () {
+			console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+			this.enableZoom = ! value;
 
-				console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
-				return ! this.enableZoom;
+		}
 
-			},
+	},
 
-			set: function ( value ) {
+	noRotate: {
 
-				console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
-				this.enableZoom = ! value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+			return ! this.enableRotate;
 
 		},
 
-		noRotate: {
+		set: function ( value ) {
 
-			get: function () {
+			console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+			this.enableRotate = ! value;
 
-				console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
-				return ! this.enableRotate;
+		}
 
-			},
+	},
 
-			set: function ( value ) {
+	noPan: {
 
-				console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
-				this.enableRotate = ! value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+			return ! this.enablePan;
 
 		},
 
-		noPan: {
+		set: function ( value ) {
 
-			get: function () {
+			console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+			this.enablePan = ! value;
 
-				console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
-				return ! this.enablePan;
+		}
 
-			},
+	},
 
-			set: function ( value ) {
+	noKeys: {
 
-				console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
-				this.enablePan = ! value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+			return ! this.enableKeys;
 
 		},
 
-		noKeys: {
+		set: function ( value ) {
 
-			get: function () {
+			console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+			this.enableKeys = ! value;
 
-				console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
-				return ! this.enableKeys;
+		}
 
-			},
+	},
 
-			set: function ( value ) {
+	staticMoving : {
 
-				console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
-				this.enableKeys = ! value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+			return ! this.constraint.enableDamping;
 
 		},
 
-		staticMoving : {
+		set: function ( value ) {
 
-			get: function () {
+			console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+			this.constraint.enableDamping = ! value;
 
-				console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
-				return ! this.constraint.enableDamping;
+		}
 
-			},
+	},
 
-			set: function ( value ) {
+	dynamicDampingFactor : {
 
-				console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
-				this.constraint.enableDamping = ! value;
+		get: function () {
 
-			}
+			console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+			return this.constraint.dampingFactor;
 
 		},
 
-		dynamicDampingFactor : {
-
-			get: function () {
-
-				console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
-				return this.constraint.dampingFactor;
-
-			},
+		set: function ( value ) {
 
-			set: function ( value ) {
-
-				console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
-				this.constraint.dampingFactor = value;
-
-			}
+			console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+			this.constraint.dampingFactor = value;
 
 		}
 
-	} );
+	}
 
-}() );
+} );