mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Make Component#enabled work for row type.
This commit is contained in:
parent
f4c4522c18
commit
e1fba03b34
2 changed files with 17 additions and 6 deletions
|
@ -98,6 +98,8 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
||||||
this._row = row;
|
this._row = row;
|
||||||
this._parent = parent; // The parent component, if any.
|
this._parent = parent; // The parent component, if any.
|
||||||
this._nested = !!parent;
|
this._nested = !!parent;
|
||||||
|
if (!parent)
|
||||||
|
DomElement.set(row, 'id', 'palettejs-row-' + name);
|
||||||
var type = this._type = props.type in this._types
|
var type = this._type = props.type in this._types
|
||||||
? props.type
|
? props.type
|
||||||
: 'options' in props
|
: 'options' in props
|
||||||
|
@ -260,7 +262,13 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
||||||
this._previousEnabled = enabled ? undefined : prev; // clear
|
this._previousEnabled = enabled ? undefined : prev; // clear
|
||||||
enabled = enabled && prev;
|
enabled = enabled && prev;
|
||||||
}
|
}
|
||||||
DomElement.set(this._input, 'disabled', !enabled);
|
if (this._input) {
|
||||||
|
DomElement.set(this._input, 'disabled', !enabled);
|
||||||
|
} else if (this._components) {
|
||||||
|
for (var i = 0; i < this._components.length; i++) {
|
||||||
|
this._components[i].setEnabled(enabled, _fromPalette);
|
||||||
|
}
|
||||||
|
}
|
||||||
this._enabled = !!enabled;
|
this._enabled = !!enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,14 @@ var Pane = Base.extend(Callback, /** @lends Pane# */{
|
||||||
this._values = values;
|
this._values = values;
|
||||||
this._numCells = 2; // 2 cells per row is the default (label / item).
|
this._numCells = 2; // 2 cells per row is the default (label / item).
|
||||||
for (var name in components) {
|
for (var name in components) {
|
||||||
var row = DomElement.create('tr', { class: 'palettejs-row' }),
|
var component = components[name];
|
||||||
component = new Component(this, name, components[name],
|
if (Base.isPlainObject(component)) {
|
||||||
values[name], row);
|
var row = DomElement.addChildren(this._table,
|
||||||
DomElement.set(row, 'id', 'palettejs-row-' + component._name);
|
['tr', { class: 'palettejs-row' }])[0];
|
||||||
this._table.appendChild(row);
|
new Component(this, name, components[name], values[name], row);
|
||||||
|
} else {
|
||||||
|
delete components[name];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this._numCells > 2) {
|
if (this._numCells > 2) {
|
||||||
// Update colspan in all components that are not nested in another
|
// Update colspan in all components that are not nested in another
|
||||||
|
|
Loading…
Reference in a new issue