Browse Source

Pull request #2136: REPORT-37821 frm绝对布局框选多个组件有问题

Merge in DESIGN/design from ~HADES/design:final/10.0 to final/10.0

* commit 'ea06a7b22458583df9cf14eecf94fe49812390c2':
  REPORT-37821  frm绝对布局框选多个组件有问题
final/10.0
Kara 4 years ago
parent
commit
d3ff061b15
  1. 12
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

12
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -195,6 +195,7 @@ public class EditingMouseListener extends MouseInputAdapter {
*/
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());
MouseEvent clickEvent = 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);
@ -219,14 +220,21 @@ public class EditingMouseListener extends MouseInputAdapter {
lastPressEvent = null;
lastXCreator = null;
e.translatePoint(oldX - e.getX(), oldY - e.getY());
if (pressX != oldX || pressY != oldY) {
if (isAutoFire(transEvent, clickEvent)) {
// click只有在mouseReleased和mousePressed前后x/y坐标相等时才会被触发在mouseReleased之后
// 但是当使用者来回点击切换时 存在mouseReleased和mousePressed前后x/y坐标不相等的情况 即鼠标按下去的位置和鼠标释放的位置不相等 存在偏移
// 当这种偏移很小时 看起来就好像是点击了 实际上是手抖了或者鼠标轻微滑动了 所以这里对这种情况要有容错处理
mouseClicked(transEvent);
mouseClicked(clickEvent);
}
}
private boolean isAutoFire(MouseEvent transEvent, MouseEvent clickEvent ) {
offsetEventPoint(transEvent);
XCreator xCreator = designer.getComponentAt(transEvent);
return (pressX != clickEvent.getX() || pressY != clickEvent.getY())
&& xCreator != null && xCreator.acceptType(XCardSwitchButton.class);
}
private void mouseDraggingRelease(MouseEvent e) {
// 当前鼠标所在的组件
XCreator hoveredComponent = designer.getComponentAt(e.getX(), e.getY());

Loading…
Cancel
Save