mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Optimise GradientStop constructor for better minification.
This commit is contained in:
parent
15824e7aaf
commit
05ab8910ea
1 changed files with 11 additions and 8 deletions
|
@ -30,19 +30,22 @@ var GradientStop = this.GradientStop = Base.extend(/** @lends GradientStop# */{
|
|||
*/
|
||||
initialize: function(arg0, arg1) {
|
||||
if (arg0) {
|
||||
var color, rampPoint;
|
||||
if (arg1 === undefined && Array.isArray(arg0)) {
|
||||
// [color, rampPoint]
|
||||
this.setColor(arg0[0]);
|
||||
this.setRampPoint(arg0[1]);
|
||||
} else if (arg0 && arg0.color) {
|
||||
color = arg0[0];
|
||||
rampPoint = arg0[1];
|
||||
} else if (arg0.color) {
|
||||
// stop
|
||||
this.setColor(arg0.color);
|
||||
this.setRampPoint(arg0.rampPoint);
|
||||
color = arg0.color;
|
||||
rampPoint = arg0.rampPoint;
|
||||
} else {
|
||||
// color [, rampPoint]
|
||||
this.setColor(arg0);
|
||||
this.setRampPoint(arg1);
|
||||
// color, rampPoint
|
||||
color = arg0;
|
||||
rampPoint = arg1;
|
||||
}
|
||||
this.setColor(color);
|
||||
this.setRampPoint(rampPoint);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue