From 845ade7207984ecd45af897ba1832ba9297ac498 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 13 Jul 2021 16:18:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-53130=20=E9=81=BF=E5=85=8D=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE=E9=9D=A2=E6=9D=BF=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=9C=A8=E7=82=B9=E5=87=BB=E5=BD=93=E5=89=8D=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E8=A2=AB=E9=87=8D=E7=BD=AE=E5=88=B0?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/models/SelectionModel.java | 5 ++++- .../src/main/java/com/fr/design/mainframe/FormDesigner.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index d105aaf48..ceb559a2e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -30,6 +30,7 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; import java.awt.LayoutManager; import java.awt.Rectangle; @@ -83,7 +84,9 @@ public class SelectionModel { XCreator comp = designer.getComponentAt(e); if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) { // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 - selection.reset(); + if (!StringUtils.equals(selection.getSelectedCreator().toData().getWidgetName(), comp.toData().getWidgetName())) { + selection.reset(); + } } else { //按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中 XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 1d4fad8e3..cab59d66e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -68,6 +68,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.third.javax.annotation.Nullable; @@ -1476,7 +1477,10 @@ public class FormDesigner extends TargetComponent
implements TreeSelection editingMouseListener.stopEditing(); editingMouseListener.stopEditTopLayout(comp); - editingMouseListener.getSelectionModel().reset(); + if (!StringUtils.equals(editingMouseListener.getSelectionModel().getSelection().getSelectedCreator().toData().getWidgetName(), comp.toData().getWidgetName())) { + editingMouseListener.getSelectionModel().reset(); + } + editingMouseListener.getSelectionModel().selectACreator(comp); }