Browse Source

Merge branch 'release/11.0' into final/11.0

new-design
Starryi 3 years ago
parent
commit
3e4250f00c
  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