mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Make sure Gradient#stops and #radial are alway set.
This commit is contained in:
parent
26efbdb451
commit
0d125e1a12
1 changed files with 4 additions and 2 deletions
|
@ -21,12 +21,14 @@ var Gradient = this.Gradient = Base.extend(/** @lends Gradient# */{
|
||||||
initialize: function(stops, radial) {
|
initialize: function(stops, radial) {
|
||||||
// Define this Gradient's unique id.
|
// Define this Gradient's unique id.
|
||||||
this._id = ++Base._uid;
|
this._id = ++Base._uid;
|
||||||
if (!stops || !this._set(stops)) {
|
if (stops && this._set(stops))
|
||||||
|
stops = radial = null;
|
||||||
|
if (!this._stops)
|
||||||
this.setStops(stops || ['white', 'black']);
|
this.setStops(stops || ['white', 'black']);
|
||||||
|
if (this._radial == null)
|
||||||
// Support old string type argument and new radial boolean.
|
// Support old string type argument and new radial boolean.
|
||||||
this.setRadial(typeof radial === 'string' && radial === 'radial'
|
this.setRadial(typeof radial === 'string' && radial === 'radial'
|
||||||
|| radial || false);
|
|| radial || false);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_serialize: function(options, dictionary) {
|
_serialize: function(options, dictionary) {
|
||||||
|
|
Loading…
Reference in a new issue