From 776c38aa4e32a939675de8f5e5639a7ffd0ad810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 14:08:18 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-66884=20=E4=BF=AE=E6=AD=A3=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E7=BB=84=E4=BB=B6=E6=97=B6=E5=80=99=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/DraggingModel.java | 10 ---------- .../mainframe/FormCreatorDropTarget.java | 6 +----- .../com/fr/design/mainframe/FormDesigner.java | 20 +++++++------------ .../guide/creator/GuideCreateUtils.java | 7 ++++--- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java index 6308ff70b5..95e003faf3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/DraggingModel.java @@ -14,7 +14,6 @@ public class DraggingModel { private MouseEvent currentDragEvent; private int creatorLeftTopX = -999; // 隐藏 private int creatorLeftTopY = -999; // 隐藏 - private boolean dragNewWidget; // 是否正在拖拽一个新的组件下来 public DraggingModel() { @@ -40,11 +39,6 @@ public class DraggingModel { return this; } - public DraggingModel dragNewWidget(boolean dragNewWidget) { - this.dragNewWidget = dragNewWidget; - return this; - } - public FormDesigner getDesigner() { return designer; } @@ -79,10 +73,6 @@ public class DraggingModel { return creatorLeftTopY; } - public boolean isDragNewWidget() { - return dragNewWidget; - } - public void moveTo(int x, int y) { XLayoutContainer container = designer.getDraggingHotspotLayout(); LayoutAdapter adapter = container.getLayoutAdapter(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index aa58d713e5..62e256379c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -264,11 +264,7 @@ public class FormCreatorDropTarget extends DropTarget { Point loc = dtde.getLocation(); int x = designer.getRelativeX(loc.x); int y = designer.getRelativeY(loc.y); - if (model.isDragNewWidget()) { - designer.addNewWidget(creator, x, y); - } else { - designer.changeWidgetPlace(creator, x, y); - } + designer.addWidgetToForm(creator, x, y); // 放到事件末尾执行 SwingUtilities.invokeLater(new Runnable() { @Override 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 a703512aba..0e28ef3b69 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 @@ -1252,12 +1252,12 @@ public class FormDesigner extends TargetComponent