mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Only expose observed component value in values object if it was already defined there initially.
It seems like too much magic to expose values defined on components there too.
This commit is contained in:
parent
d4c509b4d4
commit
2217bc2c29
1 changed files with 13 additions and 11 deletions
|
@ -168,16 +168,18 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
|||
DomElement.set(component._cell, 'colspan', numCells - 1);
|
||||
// Replace each entry in values with getters/setters so we can
|
||||
// directly link the value to the component and observe change.
|
||||
Base.define(values, key, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function() {
|
||||
return component.getValue();
|
||||
},
|
||||
set: function(val) {
|
||||
component.setValue(val);
|
||||
}
|
||||
});
|
||||
if (key in values) {
|
||||
Base.define(values, key, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function() {
|
||||
return component.getValue();
|
||||
},
|
||||
set: function(val) {
|
||||
component.setValue(val);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Add child components directly to this component, so we can access
|
||||
// it through the same path as in the components object literal that
|
||||
|
@ -234,7 +236,7 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
|||
this.setValue(value);
|
||||
// Start firing change events after we have initialized.
|
||||
this._dontFire = false;
|
||||
values[name] = this._defaultValue = this._value;
|
||||
this._defaultValue = this._value;
|
||||
},
|
||||
|
||||
getType: function() {
|
||||
|
|
Loading…
Reference in a new issue