提交 40be5eb1 编写于 作者: N Nate Williford

Updated regex to allow spaces in rgb style.

上级 a00f4cf5
......@@ -96,9 +96,9 @@ THREE.Color.prototype = {
// rgb(255,0,0)
if ( /^rgb\((\d+),(\d+),(\d+)\)$/i.test( style ) ) {
if ( /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test( style ) ) {
var color = /^rgb\((\d+),(\d+),(\d+)\)$/i.exec( style );
var color = /^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec( style );
this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;
this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;
......@@ -110,9 +110,9 @@ THREE.Color.prototype = {
// rgb(100%,0%,0%)
if ( /^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test( style ) ) {
if ( /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test( style ) ) {
var color = /^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec( style );
var color = /^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec( style );
this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;
this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册