Ver Fonte

Improve Vector2 closure performance

Tristan VALCKE há 8 anos atrás
pai
commit
5f2187fbef
1 ficheiros alterados com 2 adições e 8 exclusões
  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 );