From 5d9ec7b72898a9cbd891d2c3c634123276b1efa2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 23 Dec 2021 11:12:07 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-65170=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E3=80=91=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E7=9A=84=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C=E5=8F=B3=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E8=BE=B9=E6=A1=86=E7=BA=BF=E7=9C=8B=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 补充下双重线的处理逻辑 【改动思路】 同上 --- .../fr/design/cell/CellStylePreviewPane.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index 899c04cb1..b4b382af5 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -7,6 +7,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.general.FRFont; import com.fr.general.IOUtils; +import com.fr.stable.Constants; import com.fr.stable.unit.PT; import javax.swing.JPanel; @@ -153,16 +154,16 @@ public class CellStylePreviewPane extends JPanel { float adjustRight = 0; float adjustBottom = 0; if (column == 0) { - adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F; + adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F + computeOffset4DoubleStyleBorder(style); } if (row == 0) { - adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F; + adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F + computeOffset4DoubleStyleBorder(style); } if (column == columnSpan - 1) { - adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F; + adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F - computeOffset4DoubleStyleBorder(style); } if (row == rowSpan - 1) { - adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F; + adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F - computeOffset4DoubleStyleBorder(style); } g2d.translate(adjustLeft, adjustTop); @@ -170,6 +171,17 @@ public class CellStylePreviewPane extends JPanel { g2d.translate(-adjustLeft, -adjustTop); } + private float computeOffset4DoubleStyleBorder(Style style) { + float offset = 0F; + if (style.getBorderLeft() == Constants.LINE_DOUBLE) { + offset += GraphHelper.getLineStyleSize(Constants.LINE_THIN) / 2.0F; + } else if (style.getBorderLeft() == Constants.LINE_DOUBLE_DOT) { + offset += GraphHelper.getLineStyleSize(Constants.LINE_DOT) / 2.0F; + } + + return offset; + } + @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize();