mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -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 {
|
||||
// Called on a subclass instance. Return the converted
|
||||
// color.
|
||||
var color = arg._colorType ? arg
|
||||
: Color.read(arguments, 0, 1);
|
||||
return (colorType !== color._colorType)
|
||||
? color.convert(colorType)
|
||||
: color.clone();
|
||||
return (arg._colorType ? arg : Color.read(arguments))
|
||||
.convert(colorType);
|
||||
}
|
||||
} else if (typeof arg === 'string') {
|
||||
var rgbColor = arg.match(/^#[0-9a-f]{3,6}$/i)
|
||||
|
|
Loading…
Reference in a new issue