Browse Source

REPORT-38969 修改按照点击坐标获取组件的逻辑

feature/big-screen
Yuan.Wang 4 years ago
parent
commit
2b73c4dc26
  1. 18
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

18
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -38,6 +38,7 @@ import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.DesignerOpenedListener;
@ -64,6 +65,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
@ -845,6 +847,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
x -= creator.getX();
y -= creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
rect.y += nestTabCount(creator) * WCardMainBorderLayout.TAB_HEIGHT;
// 判断是否处于交叉区域
if (!isIntersectArea(x, y, rect)) {
continue;
@ -852,11 +855,24 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (creator instanceof XWTitleLayout) {
return creator.getEditingChildCreator();
}
return creator;
return xCreatorAt(x, y, creator, null);
}
return null;
}
/**
* 计算嵌套的tab层数
*/
private int nestTabCount(Container xCreator) {
if (xCreator == null) {
return 0;
}
if (xCreator instanceof XWTabFitLayout) {
return 1 + nestTabCount(xCreator.getParent());
}
return nestTabCount(xCreator.getParent());
}
/**
* 刷新顶层组件
* */

Loading…
Cancel
Save