Browse Source

Improve Vector2 closure performance

Tristan VALCKE 8 years ago
parent
commit
5f2187fbef
1 changed files with 2 additions and 8 deletions
  1. 2 8
      src/math/Vector2.js

+ 2 - 8
src/math/Vector2.js

@@ -269,17 +269,11 @@ Object.assign( Vector2.prototype, {
 
 	clampScalar: function () {
 
-		var min, max;
+		var min = new Vector2();
+		var max = new Vector2();
 
 		return function clampScalar( minVal, maxVal ) {
 
-			if ( min === undefined ) {
-
-				min = new Vector2();
-				max = new Vector2();
-
-			}
-
 			min.set( minVal, minVal );
 			max.set( maxVal, maxVal );