Browse Source

Pull request #7407: REPORT-65170【主题边框】悬浮元素的预览图,右下的边框线看不到

Merge in DESIGN/design from ~STARRYI/design:final/11.0 to final/11.0

* commit '3e4250f00c3741eec0a5af46e6ff1c74fe15a969':
  REPORT-65170【主题边框】悬浮元素的预览图,右下的边框线看不到
new-design
starryi 3 years ago
parent
commit
3d2326879b
  1. 20
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

20
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.base.Style;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.unit.PT; import com.fr.stable.unit.PT;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -153,16 +154,16 @@ public class CellStylePreviewPane extends JPanel {
float adjustRight = 0; float adjustRight = 0;
float adjustBottom = 0; float adjustBottom = 0;
if (column == 0) { if (column == 0) {
adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F; adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F + computeOffset4DoubleStyleBorder(style);
} }
if (row == 0) { if (row == 0) {
adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F; adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F + computeOffset4DoubleStyleBorder(style);
} }
if (column == columnSpan - 1) { if (column == columnSpan - 1) {
adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F; adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F - computeOffset4DoubleStyleBorder(style);
} }
if (row == rowSpan - 1) { if (row == rowSpan - 1) {
adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F; adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F - computeOffset4DoubleStyleBorder(style);
} }
g2d.translate(adjustLeft, adjustTop); g2d.translate(adjustLeft, adjustTop);
@ -170,6 +171,17 @@ public class CellStylePreviewPane extends JPanel {
g2d.translate(-adjustLeft, -adjustTop); 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 @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize(); Dimension size = super.getPreferredSize();

Loading…
Cancel
Save