vshrink and hshrink checks.

This commit is contained in:
Christopher Jeffrey 2013-06-20 07:55:52 -05:00
parent 5ef468c192
commit dc623ee0d1
1 changed files with 16 additions and 10 deletions

View File

@ -1294,20 +1294,27 @@ Box.prototype.render = function(stop) {
}
}
// TODO: Check for 'center', recalculate yi, and xi. Better yet, simply
// move this check into this.left/width/etc.
// TODO: Check for 'center', recalculate yi, and xi. Better
// yet, simply move this check into this.left/width/etc.
if (this.shrink) {
var hw = this._getShrinkSize(content)
, h = hw.height
, w = hw.width;
if (this.options.left == null && this.options.right != null) {
xi_ = xl - w - (this.border ? 2 : 0) - this.padding;
//xi_--; // make it one cell wider for newlines
} else {
xl = xi_ + w + (this.border ? 2 : 0) + this.padding;
//xl++; // make it one cell wider for newlines
if (this.options.width == null
&& (this.options.left == null
|| this.options.right == null)) {
if (this.options.left == null && this.options.right != null) {
xi_ = xl - w - (this.border ? 2 : 0) - this.padding;
//xi_--; // make it one cell wider for newlines
} else {
xl = xi_ + w + (this.border ? 2 : 0) + this.padding;
//xl++; // make it one cell wider for newlines
}
}
if (this.childBase == null) {
if (this.options.height == null
&& (this.options.top == null
|| this.options.bottom == null)
&& this.childBase == null) {
if (this.options.top == null && this.options.bottom != null) {
yi_ = yl - h - (this.border ? 2 : 0) - this.padding;
} else {
@ -1720,7 +1727,6 @@ List.prototype.add = function(item) {
top: this.items.length + (this.border ? 1 : 0),
left: (this.border ? 1 : 0) + 1,
right: (this.border ? 1 : 0) + 1,
full: true,
height: 1
});