From 2c27f88fef34d92083af6895e7234555bb4b4773 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Sun, 8 Sep 2019 20:32:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8Cson?= =?UTF-8?q?ar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/layout/TableLayout.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index b812263c6..43a7b7eed 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -321,7 +321,7 @@ public class TableLayout implements LayoutManager2, Serializable { this row/column. */ public static final double MINIMUM = -3.0; - + final double epsilon = 0.0000001; //****************************************************************************** //** Constructors *** @@ -1807,8 +1807,8 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) if (crSpec[z][counter] >= 1.0) scalableSize -= crSpec[z][counter]; - else if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon || + Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { scalableSize -= crPrefMin[counter]; } @@ -1824,13 +1824,13 @@ public class TableLayout implements LayoutManager2, Serializable { // Add scaled size to relativeWidth relativeSize += crSpec[z][counter]; // Cr is fill - else if ((crSpec[z][counter] == FILL) && (fillSizeRatio != 0.0)) + else if (Math.abs(crSpec[z][counter] - FILL) < epsilon && Math.abs(fillSizeRatio - 0.0) >= epsilon) // Add fill size to relativeWidth relativeSize += fillSizeRatio; } // Determine the total scaled size as estimated by this component - if (relativeSize == 0) + if (Math.abs(relativeSize - 0) < epsilon) temp = 0; else temp = (int) (scalableSize / relativeSize + 0.5); @@ -1851,8 +1851,8 @@ public class TableLayout implements LayoutManager2, Serializable { if (crSpec[z][counter] >= 1.0) totalSize += (int) (crSpec[z][counter] + 0.5); // Is the current cr a preferred/minimum size - else if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon|| + Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { // Add preferred/minimum width totalSize += crPrefMin[counter]; } From fd4471bd17395b417c1f28c00ba79170a27e594c Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Sun, 8 Sep 2019 20:36:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8Cson?= =?UTF-8?q?ar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/layout/TableLayout.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index 8d1668297..961d3e23e 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -322,7 +322,7 @@ public class TableLayout implements LayoutManager2, Serializable { this row/column. */ public static final double MINIMUM = -3.0; - final double epsilon = 0.0000001; + public static final double EPSILON = 0.0000001; //****************************************************************************** //** Constructors *** @@ -1808,8 +1808,8 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = entry.cr1[z]; counter <= entry.cr2[z]; counter++) if (crSpec[z][counter] >= 1.0) scalableSize -= crSpec[z][counter]; - else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon || - Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON || + Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { scalableSize -= crPrefMin[counter]; } @@ -1825,13 +1825,13 @@ public class TableLayout implements LayoutManager2, Serializable { // Add scaled size to relativeWidth relativeSize += crSpec[z][counter]; // Cr is fill - else if (Math.abs(crSpec[z][counter] - FILL) < epsilon && Math.abs(fillSizeRatio - 0.0) >= epsilon) + else if (Math.abs(crSpec[z][counter] - FILL) < EPSILON && Math.abs(fillSizeRatio - 0.0) >= EPSILON) // Add fill size to relativeWidth relativeSize += fillSizeRatio; } // Determine the total scaled size as estimated by this component - if (Math.abs(relativeSize - 0) < epsilon) + if (Math.abs(relativeSize - 0) < EPSILON) temp = 0; else temp = (int) (scalableSize / relativeSize + 0.5); @@ -1852,8 +1852,8 @@ public class TableLayout implements LayoutManager2, Serializable { if (crSpec[z][counter] >= 1.0) totalSize += (int) (crSpec[z][counter] + 0.5); // Is the current cr a preferred/minimum size - else if (Math.abs(crSpec[z][counter] - PREFERRED) < epsilon|| - Math.abs(crSpec[z][counter] - MINIMUM) < epsilon) { + else if (Math.abs(crSpec[z][counter] - PREFERRED) < EPSILON|| + Math.abs(crSpec[z][counter] - MINIMUM) < EPSILON) { // Add preferred/minimum width totalSize += crPrefMin[counter]; }