diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java index 977d55a68..ff036c8ef 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java @@ -1,8 +1,13 @@ package com.fr.design.mainframe; +import com.fr.design.designer.creator.XChartEditor; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.form.parameter.FormParaDesigner; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.utils.ComponentUtils; import com.fr.stable.Constants; import com.fr.stable.GraphDrawHelper; @@ -131,6 +136,11 @@ public class FormSpacingLineDrawer { GraphDrawHelper.drawString(g2d, text, labelX, labelY); } + private boolean isSelectedParaComponent() { + return designer.getSelectionModel().getSelection().size() == 1 && + designer.getParaComponent() == designer.getSelectionModel().getSelection().getSelectedCreator(); + } + private boolean isSelectedRootComponent() { return designer.getSelectionModel().getSelection().size() == 1 && designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator()); @@ -146,11 +156,38 @@ public class FormSpacingLineDrawer { } private boolean isSelectedRootPane() { - return isSelectedForm() || isSelectedRootComponent(); + // form、body、para这三个选中了,都不要画任何间距线 + return isSelectedForm() || isSelectedRootComponent() || isSelectedParaComponent(); + } + + // 当前组件是否在参数面板里面 + private boolean isCompInPara(XCreator creator) { + XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator); + + boolean xCreatorAccept = creator.acceptType(XWParameterLayout.class); + boolean containerAccept = container != null && container.acceptType(XWParameterLayout.class); + + return xCreatorAccept || containerAccept; + } + + private boolean isBodyAbsoluteLayout() { + return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer); + } + + private boolean isSelectedCompInPara() { + return isCompInPara(designer.getSelectionModel().getSelection().getSelectedCreator()); + } + + private boolean isHoveredCompInPara() { + return isCompInPara(hoverCreator); + } + + private boolean isSelectedCompOrHoveredCompInPara() { + return isSelectedCompInPara() || isHoveredCompInPara(); } private boolean isDrawSpacingLine() { - return !isSelectedRootPane() && hoverCreator != null && isMouseMoveEvent; + return isBodyAbsoluteLayout() && !isSelectedRootPane() && hoverCreator != null && !isSelectedCompOrHoveredCompInPara() && isMouseMoveEvent; } private AbstractFormParallelLine[] getNearestHorizontalSide() { @@ -205,6 +242,10 @@ public class FormSpacingLineDrawer { if (parent == component) { return null; } + + if (component instanceof XChartEditor || component instanceof XElementCase) { + return (XCreator) component.getParent(); + } return component; } } else {