readme. comments. temporary workaround for non-autoPadding list-table.

This commit is contained in:
Christopher Jeffrey 2015-03-31 00:37:32 -07:00
parent 8793be5562
commit b067845242
2 changed files with 28 additions and 18 deletions

View File

@ -1068,7 +1068,7 @@ A stylized table of text elements.
- inherits all from Box. - inherits all from Box.
- __setRows/setData(rows)__ - set rows in table. array of arrays of strings. - __setRows/setData(rows)__ - set rows in table. array of arrays of strings.
``` ``` js
table.setData([ table.setData([
[ 'Animals', 'Foods' ], [ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ], [ 'Elephant', 'Apple' ],
@ -1077,13 +1077,13 @@ A stylized table of text elements.
``` ```
#### ListTable (from Box) #### ListTable (from List)
A stylized table of text elements with a list. A stylized table of text elements with a list.
##### Options: ##### Options:
- inherits all from Box. - inherits all from List.
- __rows/data__ - array of array of strings representing rows. - __rows/data__ - array of array of strings representing rows.
- __pad__ - spaces to attempt to pad on the sides of each cell. `2` by default: - __pad__ - spaces to attempt to pad on the sides of each cell. `2` by default:
one space on each side. one space on each side.
@ -1092,17 +1092,17 @@ A stylized table of text elements with a list.
##### Properties: ##### Properties:
- inherits all from Box. - inherits all from List.
##### Events: ##### Events:
- inherits all from Box. - inherits all from List.
##### Methods: ##### Methods:
- inherits all from Box. - inherits all from Box.
- __setRows/setData(rows)__ - set rows in table. array of arrays of strings. - __setRows/setData(rows)__ - set rows in table. array of arrays of strings.
``` ``` js
table.setData([ table.setData([
[ 'Animals', 'Foods' ], [ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ], [ 'Elephant', 'Apple' ],

View File

@ -3272,6 +3272,15 @@ Element.prototype._getShrinkBox = function(xi, xl, yi, yl, get) {
xl = mxl; xl = mxl;
if (!this.screen.autoPadding) { if (!this.screen.autoPadding) {
xl += this.padding.left + this.padding.right; xl += this.padding.left + this.padding.right;
// XXX Temporary workaround until we decide to make autoPadding default.
// See widget-listtable.js for an example of why this is necessary.
// XXX Maybe just to this for all this being that this would affect
// width shrunken normal shrunken lists as well.
// if (this._isList) {
if (this.type === 'list-table') {
xl -= this.padding.left + this.padding.right;
xl += this.iright;
}
} else { } else {
//xl += this.padding.right; //xl += this.padding.right;
xl += this.iright; xl += this.iright;
@ -4659,6 +4668,7 @@ List.prototype.appendItem = function(item) {
} }
// if (this.shrink) { // if (this.shrink) {
// XXX NOTE: Maybe just do this on all shrinkage once autoPadding is default?
if (this.shrink && this.options.normalShrink) { if (this.shrink && this.options.normalShrink) {
delete options.right; delete options.right;
options.width = 'shrink'; options.width = 'shrink';