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..bf1c84990 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,14 @@ public class SelectionModel { XCreator comp = designer.getComponentAt(e); if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) { // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 + XCreator selectXCreator = selection.getSelectedCreator(); + if (selectXCreator != null && comp != null) { + if (StringUtils.equals(selectXCreator.toData().getWidgetName(), comp.toData().getWidgetName())) { + return; + } + } 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..65fc96b7e 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,6 +1477,12 @@ public class FormDesigner extends TargetComponent
implements TreeSelection editingMouseListener.stopEditing(); editingMouseListener.stopEditTopLayout(comp); + XCreator selectXCreator = editingMouseListener.getSelectionModel().getSelection().getSelectedCreator(); + if (selectXCreator != null && comp != null) { + if (StringUtils.equals(selectXCreator.toData().getWidgetName(), comp.toData().getWidgetName())) { + return; + } + } editingMouseListener.getSelectionModel().reset(); editingMouseListener.getSelectionModel().selectACreator(comp); }