mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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) {
|
initialize: function(arg0, arg1) {
|
||||||
if (arg0) {
|
if (arg0) {
|
||||||
|
var color, rampPoint;
|
||||||
if (arg1 === undefined && Array.isArray(arg0)) {
|
if (arg1 === undefined && Array.isArray(arg0)) {
|
||||||
// [color, rampPoint]
|
// [color, rampPoint]
|
||||||
this.setColor(arg0[0]);
|
color = arg0[0];
|
||||||
this.setRampPoint(arg0[1]);
|
rampPoint = arg0[1];
|
||||||
} else if (arg0 && arg0.color) {
|
} else if (arg0.color) {
|
||||||
// stop
|
// stop
|
||||||
this.setColor(arg0.color);
|
color = arg0.color;
|
||||||
this.setRampPoint(arg0.rampPoint);
|
rampPoint = arg0.rampPoint;
|
||||||
} else {
|
} else {
|
||||||
// color [, rampPoint]
|
// color, rampPoint
|
||||||
this.setColor(arg0);
|
color = arg0;
|
||||||
this.setRampPoint(arg1);
|
rampPoint = arg1;
|
||||||
}
|
}
|
||||||
|
this.setColor(color);
|
||||||
|
this.setRampPoint(rampPoint);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue