mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Optimise chained return statements.
This commit is contained in:
parent
f02b7031a9
commit
aae88d7568
1 changed files with 9 additions and 9 deletions
|
@ -66,15 +66,15 @@ var Color = this.Color = Base.extend(new function() {
|
|||
if (!this._colorType) {
|
||||
// Called on the abstract Color class. Guess color type
|
||||
// from arg
|
||||
if (arg.red !== undefined) {
|
||||
return new RGBColor(arg.red, arg.green, arg.blue,
|
||||
arg.alpha);
|
||||
} else if (arg.gray !== undefined) {
|
||||
return new GrayColor(arg.gray, arg.alpha);
|
||||
} else if (arg.hue !== undefined) {
|
||||
return new HSBColor(arg.hue, arg.saturation,
|
||||
arg.brightness, arg.alpha);
|
||||
}
|
||||
return arg.red !== undefined
|
||||
? new RGBColor(arg.red, arg.green, arg.blue, arg.alpha)
|
||||
: arg.gray !== undefined
|
||||
? new GrayColor(arg.gray, arg.alpha)
|
||||
: arg.hue !== undefined
|
||||
? new HSBColor(arg.hue, arg.saturation, arg.brightness,
|
||||
arg.alpha)
|
||||
: new RGBColor(); // Fallback
|
||||
|
||||
} else {
|
||||
// Called on a subclass instance. Return the converted
|
||||
// color.
|
||||
|
|
Loading…
Reference in a new issue