Browse Source

绝对布局内部组件增加边缘中心的对齐线

master
zhouping 8 years ago
parent
commit
a912c11d73
  1. 16
      designer_base/src/com/fr/design/beans/location/MoveUtils.java

16
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -182,6 +182,14 @@ public class MoveUtils {
px.palce = x2 - width;
px.direction = SwingConstants.RIGHT;
}
if (Math.abs(bounds.x + bounds.width / 2 - left) <= SORPTION_UNIT) {
px.palce = bounds.x + bounds.width / 2;
px.direction = SwingConstants.LEFT;
}
if (Math.abs(bounds.x + bounds.width / 2 - right) <= SORPTION_UNIT) {
px.palce = bounds.x + bounds.width / 2 - width;
px.direction = SwingConstants.RIGHT;
}
}
private static void findY(PlacePointing py, Rectangle bounds, int top, int bottom, int height) {
@ -211,6 +219,14 @@ public class MoveUtils {
py.palce = y2 - height;
py.direction = SwingConstants.BOTTOM;
}
if (Math.abs(bounds.y + bounds.height / 2 - top) <= SORPTION_UNIT) {
py.palce = bounds.y + bounds.height / 2;
py.direction = SwingConstants.TOP;
}
if (Math.abs(bounds.y + bounds.height / 2 - bottom) <= SORPTION_UNIT) {
py.palce = bounds.y + bounds.height / 2 - height;
py.direction = SwingConstants.BOTTOM;
}
}
private static void findEquidistantLine(Rectangle bounds, int left, int top, int height, int width) {

Loading…
Cancel
Save