void place_children() {
int numkids = 0; for(Box c = firstPackedChild(); c != null; c = c.nextPackedSibling()) numkids++;
- //#repeat col/row colspan/rowspan contentwidth/contentheight width/height \
+ //#repeat col/row colspan/rowspan contentwidth/contentheight width/height HSHRINK/VSHRINK \
// maxwidth/maxheight cols/rows minwidth/minheight lp_h/lp_v lp_h/lp_v
do {
int nc = numkids * 2 + cols * 3 + 1 + 2;
for(int i=0; i<coeff.length; i++)
coeff[i] = (i>=child.col && i<min(child.colspan+child.col, cols)) ? (float)1.0 : (float)0.0;
lp_h.add_constraint(coeff, LinearProgramming.GE, (float)child.contentwidth);
- if (child.maxwidth < Integer.MAX_VALUE) {
+ int child_maxwidth = child.test(HSHRINK) ? min(child.maxwidth, child.contentwidth) : child.maxwidth;
+ if (child_maxwidth < Integer.MAX_VALUE) {
for(int i=0; i<coeff.length; i++)
coeff[i] = (i>=child.col && i<min(child.colspan+child.col, cols)) ? (float)1.0 : (float)0.0;
coeff[cols*2+childnum] = (float)-1.0;
- lp_h.add_constraint(coeff, LinearProgramming.EQ, (float)child.maxwidth);
+ lp_h.add_constraint(coeff, LinearProgramming.EQ, (float)child_maxwidth);
}
for(int j=0; j<coeff.length; j++) coeff[j] = (float)0.0;
childnum++;