Quellcode durchsuchen

Color: Do not use prototype for r/g/b properties. (#24061)

Michael Herzog vor 3 Jahren
Ursprung
Commit
366c97f8a4
1 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  1. 4 3
      src/math/Color.js

+ 4 - 3
src/math/Color.js

@@ -56,6 +56,10 @@ class Color {
 
 	constructor( r, g, b ) {
 
+		this.r = 1;
+		this.g = 1;
+		this.b = 1;
+
 		if ( g === undefined && b === undefined ) {
 
 			// r is THREE.Color, hex or string
@@ -607,8 +611,5 @@ class Color {
 Color.NAMES = _colorKeywords;
 
 Color.prototype.isColor = true;
-Color.prototype.r = 1;
-Color.prototype.g = 1;
-Color.prototype.b = 1;
 
 export { Color, SRGBToLinear };