Browse Source

Pull request #5715: REPORT-58919 看看绘制间距线判断的地方有没有优化的空间

Merge in DESIGN/design from ~FANGLEI/design10.0:release/11.0 to release/11.0

* commit 'a5e44c538743761610591e133fb0177145b7330e':
  REPORT-57722 看看绘制间距线判断的地方有没有优化的空间
  REPORT-57722 修正缺少的默认值
  REPORT-57722 看看绘制间距线判断的地方有没有优化的空间
persist/11.0
fanglei 3 years ago
parent
commit
7c359dc4c3
  1. 43
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

43
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -31,6 +31,7 @@ public class FormSpacingLineDrawer {
private FormDesigner designer;
private XCreator hoverCreator = null;
private XCreator selectedCreator = null;
private Rectangle selectedRec;
private Rectangle hoveredRec;
private boolean isMouseMoveEvent = false;
@ -40,19 +41,19 @@ public class FormSpacingLineDrawer {
}
public void updateMouseEvent(MouseEvent e, boolean isMouseMoveEvent) {
XCreator creator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null) {
selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (selectedCreator != null) {
this.hoverCreator = getHoverComponentAt(e.getX(), e.getY());
}
this.isMouseMoveEvent = isMouseMoveEvent;
}
public void draw(Graphics g) {
if (!isDrawSpacingLine()) {
if (!isMouseMoveEvent || selectedCreator == null || hoverCreator == null) {
return;
}
if (!hoverCreator.isParentAbsolute()) {
if (!isDrawSpacingLine()) {
return;
}
@ -137,15 +138,15 @@ public class FormSpacingLineDrawer {
}
private boolean isSelectedParaComponent() {
return designer.getParaComponent() == designer.getSelectionModel().getSelection().getSelectedCreator();
return designer.getParaComponent() == selectedCreator;
}
private boolean isSelectedRootComponent() {
return designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator());
return designer.isRoot(selectedCreator);
}
private boolean isSelectedForm() {
return designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null;
return selectedCreator.getParent() == null;
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
@ -158,33 +159,33 @@ public class FormSpacingLineDrawer {
}
// 当前组件是否在参数面板里面
private boolean isCompInPara(XCreator creator) {
private boolean isCompInBody(XCreator creator) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator);
return container != null && !container.acceptType(XWParameterLayout.class);
}
boolean xCreatorAccept = creator.acceptType(XWParameterLayout.class);
boolean containerAccept = container != null && container.acceptType(XWParameterLayout.class);
return xCreatorAccept || containerAccept;
private boolean isSelectedCompInBody() {
return isCompInBody(selectedCreator);
}
private boolean isBodyAbsoluteLayout() {
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer);
private boolean isHoveredCompInBody() {
return isCompInBody(hoverCreator);
}
private boolean isSelectedCompInPara() {
return isCompInPara(designer.getSelectionModel().getSelection().getSelectedCreator());
private boolean isCompInBody() {
return isSelectedCompInBody() && isHoveredCompInBody();
}
private boolean isHoveredCompInPara() {
return isCompInPara(hoverCreator);
private boolean isBodyAbsoluteLayout() {
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer);
}
private boolean isSelectedCompOrHoveredCompInPara() {
return isSelectedCompInPara() || isHoveredCompInPara();
private boolean isInAbsoluteLayout() {
return isBodyAbsoluteLayout() && hoverCreator.isParentAbsolute() && selectedCreator.isParentAbsolute();
}
private boolean isDrawSpacingLine() {
return isBodyAbsoluteLayout() && !isSelectedRootPane() && hoverCreator != null && !isSelectedCompOrHoveredCompInPara() && isMouseMoveEvent;
return isInAbsoluteLayout() && !isSelectedRootPane() && isCompInBody();
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {

Loading…
Cancel
Save