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..97ab02229 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 @@ -258,10 +258,24 @@ public class XCardSwitchButton extends XButton { int ey = e.getY(); //获取tab布局的位置,鼠标相对于tab按钮的位置 - XLayoutContainer mainLayout = cardLayout.getBackupParent(); + Container mainLayout = cardLayout.getBackupParent(); Point point = mainLayout.getLocation(); - double mainX = point.getX(); - double mainY = point.getY(); + int y = 0; + int x = 0; + //遍历一下,不然是相对位置,嵌套后位置不对 + while (mainLayout.getParent() != null){ + if(mainLayout instanceof XWCardLayout){ + y += mainLayout.getY(); + } + + mainLayout = mainLayout.getParent(); + + if(mainLayout instanceof XWCardMainBorderLayout){ + x += mainLayout.getX(); + } + } + double mainX = point.getX() + x; + double mainY = point.getY() + y; // 参数界面对坐标的影响 JForm jform = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();