From ae699c5dd8b456b46cd7b7eb393fbf871fb398ec Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 25 Sep 2020 17:48:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-40553=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-=E8=BF=9E=E7=BB=AD=E7=82=B9=E5=87=BB=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E8=AE=BE=E8=AE=A1=E9=9D=A2=E6=9D=BF=EF=BC=8Cbody?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=A4=84=E4=BA=8E=E6=9C=AA=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/EditingMouseListener.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 f275fa312e..e179590154 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 @@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter { // 获取焦点,以便获取热键 designer.requestFocus(); } - if (e.getButton() == MouseEvent.BUTTON1 && e.getX() > 0 && e.getY() > 0) { + if (e.getButton() == MouseEvent.BUTTON1 && !beyondValidArea(e)) { Direction dir = selectionModel.getDirectionAt(e); if (!DesignerMode.isAuthorityEditing()) { @@ -194,6 +194,15 @@ public class EditingMouseListener extends MouseInputAdapter { e.translatePoint(oldX - e.getX(), oldY - e.getY()); } + private boolean beyondValidArea(MouseEvent e) { + if (e.getX() < 0 || e.getY() < 0 || + e.getX() > designer.getRootComponent().getWidth() || + e.getY() > (designer.getRootComponent().getHeight() + designer.getParaHeight())) { + return true; + } + return false; + } + private void offsetEventPoint(MouseEvent e){ int x = designer.getRelativeX(e.getX()); int y = designer.getRelativeY(e.getY());