浏览代码

OrbitControls indentation clean up and example simplification.

Mr.doob 11 年之前
父节点
当前提交
f00cddac90
共有 2 个文件被更改,包括 7 次插入15 次删除
  1. 6 5
      examples/js/controls/OrbitControls.js
  2. 1 10
      examples/misc_controls_orbit.html

+ 6 - 5
examples/js/controls/OrbitControls.js

@@ -411,7 +411,8 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 		}
 
-        scope.update();
+		scope.update();
+
 	}
 
 	function onKeyDown( event ) {
@@ -501,7 +502,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 		var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
 
-        var needUpdate = false;
+		var needUpdate = false;
 
 		switch ( event.touches.length ) {
 
@@ -519,7 +520,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 				rotateStart.copy( rotateEnd );
 
-                needUpdate = true;
+				needUpdate = true;
 				break;
 
 			case 2: // two-fingered touch: dolly
@@ -545,7 +546,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 				dollyStart.copy( dollyEnd );
 
-                needUpdate = true;
+				needUpdate = true;
 				break;
 
 			case 3: // three-fingered touch: pan
@@ -559,7 +560,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 				panStart.copy( panEnd );
 
-                needUpdate = true;
+				needUpdate = true;
 				break;
 
 			default:

+ 1 - 10
examples/misc_controls_orbit.html

@@ -52,10 +52,8 @@
 
 			var camera, controls, scene, renderer;
 
-			var cross;
-
 			init();
-			animate();
+			render();
 
 			function init() {
 
@@ -132,13 +130,6 @@
 
 			}
 
-			function animate() {
-
-				requestAnimationFrame( animate );
-				controls.update();
-
-			}
-
 			function render() {
 
 				renderer.render( scene, camera );