From fd2bbe1e68233ce79aa24432889f8a7919df62df Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 18 Aug 2020 17:18:56 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-37588=20final=E4=BC=A0=E4=B8=80=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/cardlayout/XCardSwitchButton.java | 5 +++-- .../com/fr/design/mainframe/EditingMouseListener.java | 2 +- .../main/java/com/fr/design/mainframe/FormDesigner.java | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index f0e23b977f..bce26eb3f3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -202,7 +202,8 @@ public class XCardSwitchButton extends XButton { jPopupMenu.add(prev); jPopupMenu.add(next); jPopupMenu.add(end); - GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY()); + FormDesigner designer = editingMouseListener.getDesigner(); + GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), designer.getOriginX(e.getX()), designer.getOriginY(e.getY())); } @Override @@ -251,7 +252,7 @@ public class XCardSwitchButton extends XButton { //是否进入点击关闭按钮区域 private boolean isSelectedClose(MouseEvent e, FormDesigner designer){ - int diff = designer.getArea().getHorScrollBar().getValue(); + int diff = designer.getHorizontalScaleValue(); // mouse position int ex = e.getX() + diff; 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 d8234c2b1d..3754e5109e 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 @@ -607,7 +607,7 @@ public class EditingMouseListener extends MouseInputAdapter { if (e.getButton() == MouseEvent.BUTTON3) { UIPopupMenu cellPopupMenu = creator.createPopupMenu(designer); if (cellPopupMenu != UIPopupMenu.EMPTY) { - GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY()); + GUICoreUtils.showPopupMenu(cellPopupMenu, designer, oldX, oldY); } } creator.doLayout(); 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 f9141ca997..e5ce0f726f 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 @@ -1611,6 +1611,14 @@ public class FormDesigner extends TargetComponent
implements TreeSelection return (int) ((y - this.getPaintY()) / this.getScale()); } + public int getOriginX(int x) { + return (int) (x * this.getScale() + this.getPaintX()); + } + + public int getOriginY(int y) { + return (int) (y * this.getScale() + this.getPaintY()); + } + public int getHorizontalScaleValue() { return (int) (this.getArea().getHorizontalValue() / this.scale);