mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 22:01:58 -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) {
|
if (!this._colorType) {
|
||||||
// Called on the abstract Color class. Guess color type
|
// Called on the abstract Color class. Guess color type
|
||||||
// from arg
|
// from arg
|
||||||
if (arg.red !== undefined) {
|
return arg.red !== undefined
|
||||||
return new RGBColor(arg.red, arg.green, arg.blue,
|
? new RGBColor(arg.red, arg.green, arg.blue, arg.alpha)
|
||||||
arg.alpha);
|
: arg.gray !== undefined
|
||||||
} else if (arg.gray !== undefined) {
|
? new GrayColor(arg.gray, arg.alpha)
|
||||||
return new GrayColor(arg.gray, arg.alpha);
|
: arg.hue !== undefined
|
||||||
} else if (arg.hue !== undefined) {
|
? new HSBColor(arg.hue, arg.saturation, arg.brightness,
|
||||||
return new HSBColor(arg.hue, arg.saturation,
|
arg.alpha)
|
||||||
arg.brightness, arg.alpha);
|
: new RGBColor(); // Fallback
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Called on a subclass instance. Return the converted
|
// Called on a subclass instance. Return the converted
|
||||||
// color.
|
// color.
|
||||||
|
|
Loading…
Reference in a new issue