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