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