From 60d47de8e8db2ba90e13973cf36e70596915cca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 19 Aug 2021 18:37:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-57128&REPORT-57657=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E4=B8=AD=E4=BC=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=B4=E8=B7=9D=E7=BA=BF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?&=E4=BF=AE=E5=A4=8D=E6=8A=A5=E8=A1=A8=E5=9D=97=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=B4=E8=B7=9D?= =?UTF-8?q?=E7=BA=BF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormSpacingLineDrawer.java | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) 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 {