Define #clone() for various Gradient classes. Needs testing.

This commit is contained in:
Jürg Lehni 2011-05-19 22:02:26 +01:00
parent 38ddd34589
commit 8a8c68b3d6
3 changed files with 16 additions and 0 deletions

View file

@ -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;
},

View file

@ -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;
},

View file

@ -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;
},