Browse Source

REPORT-57128 【FRM布局推荐】组件复用-关于悬浮hover组件的交互设计更新

feature/10.0
方磊 3 years ago
parent
commit
03c1ccc659
  1. 1
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  2. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  3. 28
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

1
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -217,6 +217,7 @@ public class EditingMouseListener extends MouseInputAdapter {
int oldX = e.getX();
int oldY = e.getY();
offsetEventPoint(e);
designer.getSpacingLineDrawer().updateMouseEvent(e, false);
if (e.isPopupTrigger()) {
if (stateModel.isDragging()) {
stateModel.draggingCancel();

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

@ -1145,7 +1145,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return comp == null ? container : comp;
}
private XLayoutContainer getRootContainer(int y) {
public XLayoutContainer getRootContainer(int y) {
XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent;
if (container == null) {
container = rootComponent;

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

@ -1,6 +1,8 @@
package com.fr.design.mainframe;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.utils.ComponentUtils;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
@ -35,7 +37,7 @@ public class FormSpacingLineDrawer {
public void updateMouseEvent(MouseEvent e, boolean isMouseMoveEvent) {
XCreator creator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null) {
this.hoverCreator = designer.getComponentAt(e.getX(), e.getY(), creator.getLevel());
this.hoverCreator = getHoverComponentAt(e.getX(), e.getY());
}
this.isMouseMoveEvent = isMouseMoveEvent;
}
@ -147,13 +149,8 @@ public class FormSpacingLineDrawer {
return isSelectedForm() || isSelectedRootComponent();
}
private boolean isSelectedCreatorSameParentWithHoveredCreator() {
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
return selectedCreator != null && hoverCreator != null && selectedCreator.getParent() == hoverCreator.getParent();
}
private boolean isDrawSpacingLine() {
return !isSelectedRootPane() && isSelectedCreatorSameParentWithHoveredCreator() && isMouseMoveEvent;
return !isSelectedRootPane() && hoverCreator != null && isMouseMoveEvent;
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {
@ -197,4 +194,21 @@ public class FormSpacingLineDrawer {
}
return nearestSides;
}
private XCreator getHoverComponentAt(int x, int y) {
XCreator component = designer.getComponentAt(x, y);
XLayoutContainer parent = XCreatorUtils.getHotspotContainer(component).getTopLayout();
if (parent != null) {
if (!parent.isEditable()) {
return parent;
} else {
if (parent == component) {
return null;
}
return component;
}
} else {
return component;
}
}
}

Loading…
Cancel
Save