소스 검색

Color: Clamp values in getHex(). (#23582)

mrdoob 3 년 전
부모
커밋
c626a52659
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/math/Color.js

+ 1 - 1
src/math/Color.js

@@ -336,7 +336,7 @@ class Color {
 
 	getHex() {
 
-		return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
+		return clamp( this.r * 255, 0, 255 ) << 16 ^ clamp( this.g * 255, 0, 255 ) << 8 ^ clamp( this.b * 255, 0, 255 ) << 0;
 
 	}