mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Improve component type guessing.
This commit is contained in:
parent
532a94369e
commit
61c37f0858
1 changed files with 4 additions and 3 deletions
|
@ -59,12 +59,13 @@ var Component = this.Component = Base.extend(Callback, /** @lends Component# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(obj) {
|
initialize: function(obj) {
|
||||||
this._type = obj.type
|
this._type = obj.type in this._types
|
||||||
|| ('options' in obj
|
? obj.type
|
||||||
|
: 'options' in obj
|
||||||
? 'list'
|
? 'list'
|
||||||
: 'onClick' in obj
|
: 'onClick' in obj
|
||||||
? 'button'
|
? 'button'
|
||||||
: typeof value);
|
: typeof obj.value;
|
||||||
this._info = this._types[this._type] || { type: this._type };
|
this._info = this._types[this._type] || { type: this._type };
|
||||||
var that = this,
|
var that = this,
|
||||||
fireChange = false;
|
fireChange = false;
|
||||||
|
|
Loading…
Reference in a new issue