From 39f90dcf231fe24e5e6c03b3368a33a648b148fa Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 9 Mar 2004 09:52:04 +0000 Subject: [PATCH] fixed bug 471 darcs-hash:20040309095204-5007d-cfe89d94f776f69d4003bc381545be0c1fbad8db.gz --- src/org/ibex/Box.java | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 04c591f..0e5d2a7 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -214,8 +214,10 @@ public final class Box extends JSScope implements Scheduler.Task { // static stuff so we don't have to keep reallocating private static int[] numRowsInCol = new int[65535]; private static LENGTH[] colWidth = new LENGTH[65535]; + private static LENGTH[] colMinWidth = new LENGTH[65535]; private static LENGTH[] colMaxWidth = new LENGTH[65535]; private static LENGTH[] rowHeight = new LENGTH[65535]; + private static LENGTH[] rowMinHeight = new LENGTH[65535]; private static LENGTH[] rowMaxHeight = new LENGTH[65535]; static { for(int i=0; i 0 && cols > 0 && startslack != x_slack;) { - int increment = max(1, x_slack / cols); + if (eligible == 0) break; + int increment = x_slack / eligible; + eligible = 0; startslack = x_slack; for(short col=0; col < cols; col++) { // FIXME: double check this int diff = min(min(colMaxWidth[col], colWidth[col] + increment) - colWidth[col], x_slack); + if (colWidth[col] + diff < colMinWidth[col]) diff = colMinWidth[col] - colWidth[col]; + if (diff == 0) continue; + eligible++; x_slack -= diff; colWidth[col] += diff; } -- 1.7.10.4