mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Clean up Pane code a bit.
This commit is contained in:
parent
8907662524
commit
88bc14f597
1 changed files with 5 additions and 5 deletions
|
@ -29,7 +29,7 @@ var Pane = Base.extend(Callback, /** @lends Pane# */{
|
||||||
// NOTE: We modify the actual passed components in the root pane, and
|
// NOTE: We modify the actual passed components in the root pane, and
|
||||||
// also the values objects, so the newly created components and their
|
// also the values objects, so the newly created components and their
|
||||||
// values can easily be referenced from outside.
|
// values can easily be referenced from outside.
|
||||||
this._components = parent ? {} : components;
|
var comps = this._components = parent ? {} : components;
|
||||||
this._values = values;
|
this._values = values;
|
||||||
var numCells = 0;
|
var numCells = 0;
|
||||||
this._numCells = 0;
|
this._numCells = 0;
|
||||||
|
@ -38,17 +38,17 @@ var Pane = Base.extend(Callback, /** @lends Pane# */{
|
||||||
if (Base.isPlainObject(component)) {
|
if (Base.isPlainObject(component)) {
|
||||||
var row = parentRow || DomElement.addChildren(this._table,
|
var row = parentRow || DomElement.addChildren(this._table,
|
||||||
['tr', { class: 'palettejs-row' }])[0];
|
['tr', { class: 'palettejs-row' }])[0];
|
||||||
this._components[name] = new Component(this, name, component,
|
comps[name] = new Component(this, name, component,
|
||||||
values, row, parent);
|
values, row, parent);
|
||||||
numCells = Math.max(numCells, this._numCells);
|
numCells = Math.max(numCells, this._numCells);
|
||||||
|
// Do not reset cell counter if all components go to the same
|
||||||
|
// parent row.
|
||||||
if (!parentRow)
|
if (!parentRow)
|
||||||
this._numCells = 0;
|
this._numCells = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._numCells = numCells;
|
this._numCells = numCells;
|
||||||
// Override in case we made a copy, see above.
|
Base.each(comps, function(component, name) {
|
||||||
components = this._components;
|
|
||||||
Base.each(components, function(component, name) {
|
|
||||||
// Update colspan in all components that are not nested in another
|
// Update colspan in all components that are not nested in another
|
||||||
// component.
|
// component.
|
||||||
if (numCells > 2 && component._cell && !component._nested) {
|
if (numCells > 2 && component._cell && !component._nested) {
|
||||||
|
|
Loading…
Reference in a new issue