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 f0e23b977..bce26eb3f 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 d8234c2b1..3754e5109 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 f9141ca99..e5ce0f726 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);