Browse Source

remove closure of clampLength

Mugen87 9 years ago
parent
commit
525b9c672d
2 changed files with 8 additions and 20 deletions
  1. 4 10
      src/math/Vector2.js
  2. 4 10
      src/math/Vector3.js

+ 4 - 10
src/math/Vector2.js

@@ -290,15 +290,11 @@ THREE.Vector2.prototype = {
 
 	}(),
 
-	clampLength: function () {
+	clampLength: function ( min, max ) {
 
-		var oldLength, newLength;
+			var oldLength = this.length();
 
-		return function clampLength( min, max ) {
-
-			oldLength = this.length();
-
-			newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
+			var newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
 
 			if ( newLength !== oldLength ) {
 
@@ -308,9 +304,7 @@ THREE.Vector2.prototype = {
 
 			return this;
 
-		};
-
-	}(),
+	},
 
 	floor: function () {
 

+ 4 - 10
src/math/Vector3.js

@@ -520,15 +520,11 @@ THREE.Vector3.prototype = {
 
 	}(),
 
-	clampLength: function () {
+	clampLength: function ( min, max ) {
 
-		var oldLength, newLength;
+			var oldLength = this.length();
 
-		return function clampLength( min, max ) {
-
-			oldLength = this.length();
-
-			newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
+			var newLength = ( oldLength < min ) ? min : ( ( oldLength > max ) ? max : oldLength );
 
 			if ( newLength !== oldLength ) {
 
@@ -538,9 +534,7 @@ THREE.Vector3.prototype = {
 
 			return this;
 
-		};
-
-	}(),
+	},
 
 	floor: function () {