if (!test(REPACK)) { constrain(); return; }
boolean haskid = false;
for(Box child = getChild(0); child != null; child = child.nextSibling()) { haskid = true; child.pack(); }
- if (!haskid) { clear(REPACK); return; }
+ if (!haskid) { clear(REPACK); constrain(); return; }
int frontier_size = 0;
//#repeat COLS/ROWS rows/cols cols/rows col/row row/col colspan/rowspan rowspan/colspan \
// contentheight/contentwidth contentwidth/contentheight
void solve(boolean findMinimum) {
int numkids = 0; for(Box c = firstPackedChild(); c != null; c = c.nextPackedSibling()) numkids++;
//#repeat col/row colspan/rowspan contentwidth/contentheight width/height HSHRINK/VSHRINK numregions/numregions_v \
- // maxwidth/maxheight cols/rows minwidth/minheight regions/regions_v targetColumnSize/targetRowSize sizes/sizes_v
+ // maxwidth/maxheight cols/rows minwidth/minheight regions/regions_v targetColumnSize/targetRowSize sizes/sizes_v \
+ // HSHRINK/VSHRINK
if (numkids == 0) {
if (findMinimum) contentwidth = 0;
else targetColumnSize = 0;
if (regions[r+1] < child.col) continue;
if (regions[r] >= min(child.col+child.colspan,cols)) { minregion = r; break; }
total -= sizes[r];
+ int child_maxwidth = child.test(HSHRINK)?child.contentwidth:child.maxwidth;
if (sizes[r] <= (float)(targetColumnSize*(regions[r+1]-regions[r])))
- if ((child.colspan * targetColumnSize) > (child.maxwidth + (float)0.5))
- sizes[r] = (float)Math.min(sizes[r], (regions[r+1]-regions[r])*(child.maxwidth/child.colspan));
+ if ((child.colspan * targetColumnSize) > (child_maxwidth + (float)0.5))
+ sizes[r] = (float)Math.min(sizes[r], (regions[r+1]-regions[r])*(child_maxwidth/child.colspan));
if ((child.colspan * targetColumnSize) < (child.contentwidth - (float)0.5))
sizes[r] = (float)Math.max(sizes[r], (regions[r+1]-regions[r])*(child.contentwidth/child.colspan));
total += sizes[r];
public void put(Object name, Object value) throws JSExn {
if (name instanceof Number) { put(toInt(name), value); return; }
//#switch(name)
- case "text": CHECKSET_STRING(text); RECONSTRAIN(); DIRTY;
+ case "text": if (value == null) value = ""; CHECKSET_STRING(text); RECONSTRAIN(); DIRTY;
case "strokecolor": value = N(stringToColor((String)value)); CHECKSET_INT(strokecolor); DIRTY;
case "textcolor": value = N(stringToColor((String)value)); CHECKSET_INT(strokecolor); DIRTY;
case "strokewidth": CHECKSET_SHORT(strokewidth); DIRTY;