mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 23:39:59 -05:00
Simplify Color#initialize() by relying on #convert() for performing _colorType check and delegate to #clone() instead of #convert() if it is the same.
This commit is contained in:
parent
bfcfb23a9e
commit
300ea72261
1 changed files with 2 additions and 5 deletions
|
@ -159,11 +159,8 @@ var Color = this.Color = Base.extend(new function() {
|
||||||
} else {
|
} else {
|
||||||
// Called on a subclass instance. Return the converted
|
// Called on a subclass instance. Return the converted
|
||||||
// color.
|
// color.
|
||||||
var color = arg._colorType ? arg
|
return (arg._colorType ? arg : Color.read(arguments))
|
||||||
: Color.read(arguments, 0, 1);
|
.convert(colorType);
|
||||||
return (colorType !== color._colorType)
|
|
||||||
? color.convert(colorType)
|
|
||||||
: color.clone();
|
|
||||||
}
|
}
|
||||||
} else if (typeof arg === 'string') {
|
} else if (typeof arg === 'string') {
|
||||||
var rgbColor = arg.match(/^#[0-9a-f]{3,6}$/i)
|
var rgbColor = arg.match(/^#[0-9a-f]{3,6}$/i)
|
||||||
|
|
Loading…
Reference in a new issue