From 2433240bce61db3c66b56a4b96e69dee4b4aa54f Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 27 Aug 2020 18:22:52 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-38272=20&&=20REPORT-38287=20&&=20REPORT-?= =?UTF-8?q?37922=E3=80=90frm=E8=AE=BE=E8=AE=A1=E7=95=8C=E9=9D=A2=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=BC=A9=E6=94=BE=E3=80=91=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=8E=A7=E4=BB=B6=E5=A6=82=E6=9E=9C=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=BE=83=E5=A4=A7=E7=9A=84=E7=BC=A9=E6=94=BE=E5=B9=85=E5=BA=A6?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E9=81=AE=E6=8C=A1=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/AddingModel.java | 8 ++--- .../mainframe/EditingMouseListener.java | 29 ++++++++++++++----- .../fr/design/mainframe/FormDesignerUI.java | 8 ++--- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 637279bf28..c0b6cd400a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -133,13 +133,13 @@ public class AddingModel { Rectangle rect = ComponentUtils.getRelativeBounds(container); if (!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())) { added = container.getLayoutAdapter().addBean(creator, - x + designer.getArea().getHorizontalValue(), - y + designer.getArea().getVerticalValue()); + x + designer.getHorizontalScaleValue(), + y + designer.getVerticalScaleValue() ); return added; } added = container.getLayoutAdapter().addBean(creator, - x + designer.getArea().getHorizontalValue() - rect.x, - y + designer.getArea().getVerticalValue() - rect.y); + x + designer.getHorizontalScaleValue() - rect.x, + y + designer.getVerticalScaleValue() - rect.y); return added; } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 2fa3dea643..01de4a1dac 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -11,7 +11,13 @@ import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Location; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.StateModel; -import com.fr.design.designer.creator.*; +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.XEditorHolder; +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.form.util.XCreatorConstants; @@ -22,14 +28,20 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.LayoutUtils; - import com.fr.share.ShareConstants; import com.fr.stable.Constants; - import com.fr.stable.StringUtils; -import javax.swing.*; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPopupMenu; +import javax.swing.JWindow; +import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; -import java.awt.*; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Rectangle; import java.awt.event.MouseEvent; /** @@ -165,10 +177,13 @@ public class EditingMouseListener extends MouseInputAdapter { if (designer.isDrawLineMode()) { designer.updateDrawLineMode(e); } else { + int relativeX = Math.max(0, designer.getRelativeX(e.getX())); + int relativeY = Math.max(0, designer.getRelativeY(e.getY())); + if (selectionModel.hasSelectionComponent() && selectionModel.getSelection().getRelativeBounds().contains( - designer.getArea().getHorizontalValue() + e.getX(), - designer.getArea().getVerticalValue() + e.getY())) { + designer.getHorizontalScaleValue() + relativeX, + designer.getVerticalScaleValue() + relativeY)) { lastPressEvent = e; lastXCreator = selectionModel.getSelection().getSelectedCreator(); } else { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 68ea5c2b87..26547229bb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -409,8 +409,8 @@ public class FormDesignerUI extends ComponentUI { clipg = g.create( -designer.getHorizontalScaleValue(), -designer.getVerticalScaleValue() + designer.getParaHeight(), - (int) ((parent.getSize().width + designer.getArea().getHorizontalValue()) / designer.getScale()), - (int) ((parent.getSize().height + designer.getArea().getVerticalValue()) / designer.getScale())); + parent.getSize().width + designer.getHorizontalScaleValue(), + parent.getSize().height + designer.getVerticalScaleValue()); designer.paintContent(clipg); paintWatermark((Graphics2D) clipg); @@ -435,8 +435,8 @@ public class FormDesignerUI extends ComponentUI { Graphics clipg1; clipg1 = g.create(-designer.getHorizontalScaleValue(), -designer.getVerticalScaleValue(), - (int) ((parent.getSize().width + designer.getArea().getHorizontalValue()) / designer.getScale()), - (int) ((designer.getParaHeight() + designer.getArea().getVerticalValue()) / designer.getScale())); + parent.getSize().width + designer.getHorizontalScaleValue(), + designer.getParaHeight() + designer.getVerticalScaleValue()); designer.paintPara(clipg1); clipg1.dispose();