mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Define #clone() for various Gradient classes. Needs testing.
This commit is contained in:
parent
38ddd34589
commit
8a8c68b3d6
3 changed files with 16 additions and 0 deletions
|
@ -24,6 +24,13 @@ var Gradient = this.Gradient = Base.extend({
|
|||
this.type = type || 'linear';
|
||||
},
|
||||
|
||||
clone: function() {
|
||||
var stops = [];
|
||||
for (var i = 0, l = this._stops.length; i < l; i++)
|
||||
stops[i] = this._stops[i].clone();
|
||||
return new Gradient(stops, this.type);
|
||||
},
|
||||
|
||||
getStops: function() {
|
||||
return this._stops;
|
||||
},
|
||||
|
|
|
@ -25,6 +25,11 @@ var GradientColor = this.GradientColor = Color.extend({
|
|||
this.setHilite(hilite);
|
||||
},
|
||||
|
||||
clone: function() {
|
||||
return new GradientColor(thisgradient, this._origin, this._destination,
|
||||
this._hilite);
|
||||
},
|
||||
|
||||
getOrigin: function() {
|
||||
return this._origin;
|
||||
},
|
||||
|
|
|
@ -34,6 +34,10 @@ var GradientStop = this.GradientStop = Base.extend({
|
|||
}
|
||||
},
|
||||
|
||||
clone: function() {
|
||||
return new GradientStop(this._color.clone(), this._rampPoint);
|
||||
},
|
||||
|
||||
getRampPoint: function() {
|
||||
return this._rampPoint;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue