Optimise Gradient constructor.

This commit is contained in:
Jürg Lehni 2011-05-19 20:54:52 +01:00
parent 8eea7e15d4
commit 6348f94362

View file

@ -20,12 +20,8 @@ var Gradient = this.Gradient = Base.extend({
// TODO: should type here be called 'radial' and have it // TODO: should type here be called 'radial' and have it
// receive a boolean value? // receive a boolean value?
initialize: function(stops, type) { initialize: function(stops, type) {
if (!stops) { this.setStops(stops || ['white', 'black']);
stops = [new GradientStop('white', 0), this.type = type || 'linear';
new GradientStop('black', 1)];
}
this.setStops(stops);
this.type = type ? type : 'linear';
}, },
getStops: function() { getStops: function() {