From 672ef252d42449af04baba48a81393f4410505fa Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 14 Aug 2020 19:47:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-37289=20=E3=80=9010.0.9=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91frm=E6=A8=A1=E6=9D=BFtab=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=85=E8=BF=9B=E8=A1=8C=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E6=9D=A5=E5=9B=9E=E7=82=B9=E5=87=BB=E5=88=87=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E5=8F=91=E7=8E=B0=E4=BC=9A=E5=81=B6=E7=84=B6=E7=9A=84?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=A4=B1=E6=95=88=E6=88=96=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/EditingMouseListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 3ef72242a..d8234c2b1 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 @@ -79,6 +79,9 @@ public class EditingMouseListener extends MouseInputAdapter { //备份开始拖动的位置和大小 private Rectangle dragBackupBounds; + private int pressX; + private int pressY; + /** * 获取最小移动距离 * @@ -141,6 +144,8 @@ public class EditingMouseListener extends MouseInputAdapter { public void mousePressed(MouseEvent e) { int oldX = e.getX(); int oldY = e.getY(); + pressX = oldX; + pressY = oldY; offsetEventPoint(e); if (!stopEditing()) { return; @@ -189,6 +194,7 @@ public class EditingMouseListener extends MouseInputAdapter { * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { + MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); int oldX = e.getX(); int oldY = e.getY(); offsetEventPoint(e); @@ -213,6 +219,12 @@ public class EditingMouseListener extends MouseInputAdapter { lastPressEvent = null; lastXCreator = null; e.translatePoint(oldX - e.getX(), oldY - e.getY()); + if (pressX != oldX || pressY != oldY) { + // click只有在mouseReleased和mousePressed前后x/y坐标相等时才会被触发在mouseReleased之后 + // 但是当使用者来回点击切换时 存在mouseReleased和mousePressed前后x/y坐标不相等的情况 即鼠标按下去的位置和鼠标释放的位置不相等 存在偏移 + // 当这种偏移很小时 看起来就好像是点击了 实际上是手抖了或者鼠标轻微滑动了 所以这里对这种情况要有容错处理 + mouseClicked(transEvent); + } } private void mouseDraggingRelease(MouseEvent e) {