Browse Source

Add closures

WestLangley 7 years ago
parent
commit
de05ab26a3
1 changed files with 20 additions and 12 deletions
  1. 20 12
      src/math/Color.js

+ 20 - 12
src/math/Color.js

@@ -329,7 +329,7 @@ Object.assign( Color.prototype, {
 
 
 	},
 	},
 
 
-	copySRGBToLinear: function ( color ) {
+	copySRGBToLinear: function () {
 
 
 		function SRGBToLinear( c ) {
 		function SRGBToLinear( c ) {
 
 
@@ -337,15 +337,19 @@ Object.assign( Color.prototype, {
 
 
 		}
 		}
 
 
-		this.r = SRGBToLinear( color.r );
-		this.g = SRGBToLinear( color.g );
-		this.b = SRGBToLinear( color.b );
+		return function copySRGBToLinear( color ) {
 
 
-		return this;
+			this.r = SRGBToLinear( color.r );
+			this.g = SRGBToLinear( color.g );
+			this.b = SRGBToLinear( color.b );
 
 
-	},
+			return this;
+
+		};
+
+	}(),
 
 
-	copyLinearToSRGB: function ( color ) {
+	copyLinearToSRGB: function () {
 
 
 		function LinearToSRGB( c ) {
 		function LinearToSRGB( c ) {
 
 
@@ -353,13 +357,17 @@ Object.assign( Color.prototype, {
 
 
 		}
 		}
 
 
-		this.r = LinearToSRGB( color.r );
-		this.g = LinearToSRGB( color.g );
-		this.b = LinearToSRGB( color.b );
+		return function copyLinearToSRGB( color ) {
 
 
-		return this;
+			this.r = LinearToSRGB( color.r );
+			this.g = LinearToSRGB( color.g );
+			this.b = LinearToSRGB( color.b );
 
 
-	},
+			return this;
+
+		};
+
+	}(),
 
 
 	convertSRGBToLinear: function () {
 	convertSRGBToLinear: function () {