Browse Source

Merge pull request #283 in BA/design from ~ZHOUPING/design:dev to dev

* commit 'a2fff63ec800123ad2c970aa4a34530efccf2d0d':
  绝对布局内部组件增加边缘中心的对齐线
master
superman 8 years ago
parent
commit
10282b4738
  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.palce = x2 - width;
px.direction = SwingConstants.RIGHT; 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) { 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.palce = y2 - height;
py.direction = SwingConstants.BOTTOM; 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) { private static void findEquidistantLine(Rectangle bounds, int left, int top, int height, int width) {

Loading…
Cancel
Save