diff --git a/src/color/Color.js b/src/color/Color.js index ff3ba729..19aae8d8 100644 --- a/src/color/Color.js +++ b/src/color/Color.js @@ -320,8 +320,8 @@ var Color = this.Color = Base.extend(new function() { * @ignore */ extend: function(src) { - if (src._type) { - var comps = components[src._type]; + var comps = components[src._type]; + if (comps) { // Automatically produce the _components field, adding alpha src._components = comps.concat(['alpha']); Base.each(comps, function(name) { diff --git a/src/color/Gradient.js b/src/color/Gradient.js index 3782b4d0..f042f777 100644 --- a/src/color/Gradient.js +++ b/src/color/Gradient.js @@ -33,6 +33,11 @@ var Gradient = this.Gradient = Base.extend(/** @lends Gradient# */{ this.type = type || 'linear'; }, + _serialize: function(dictionary) { + return dictionary.get(this) || dictionary.set(this, Base.serialize( + [this._type, this._stops, this.type], true, dictionary)); + }, + /** * Called by various setters whenever a gradient value changes */ diff --git a/src/color/GradientColor.js b/src/color/GradientColor.js index 8971a4e7..346f8d57 100644 --- a/src/color/GradientColor.js +++ b/src/color/GradientColor.js @@ -16,6 +16,7 @@ * @class The GradientColor object. */ var GradientColor = this.GradientColor = Color.extend(/** @lends GradientColor# */{ + _type: 'gradientcolor', /** * Creates a gradient color object. @@ -97,6 +98,13 @@ var GradientColor = this.GradientColor = Color.extend(/** @lends GradientColor# this._hilite); }, + _serialize: function(dictionary) { + var values = [ this.gradient, this._origin, this._destination ]; + if (this._hilite) + values.push(this._hilite); + return Base.serialize(values, true, dictionary); + }, + /** * The origin point of the gradient. * diff --git a/src/color/GradientStop.js b/src/color/GradientStop.js index e802cc77..965d3b5d 100644 --- a/src/color/GradientStop.js +++ b/src/color/GradientStop.js @@ -53,6 +53,10 @@ var GradientStop = this.GradientStop = Base.extend(/** @lends GradientStop# */{ return new GradientStop(this._color.clone(), this._rampPoint); }, + _serialize: function(dictionary) { + return Base.serialize([this._color, this._rampPoint], false, dictionary); + }, + /** * Called by various setters whenever a value changes */