Explorar o código

Revert "Improve Vector2 closure performance"

This reverts commit 5f2187fbef3960f2111d498adf5e6a8c50404946.
Joe Fox %!s(int64=8) %!d(string=hai) anos
pai
achega
b6b6cad22c
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      src/math/Vector2.js

+ 8 - 2
src/math/Vector2.js

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