Point hot = dropAdapter.getHotspotPoint();
Spring spring = new Spring(10, 10);// TODO should be replaced by a
// container gap.
if (pair == null) {
Point np = new Point(p.x - hot.x, p.y - hot.y);
Constraints constraints = new Constraints(new Leading(np.x
- insets.left, drop.getWidth(), spring), new Leading(np.y
- insets.top, drop.getHeight(), spring));
container.add(drop, constraints);
} else {
Alignment horizontal = null;
Alignment vertical = null;
if (pair.hQuart == null && pair.vQuart != null) {
int x = pair.vQuart.masc - hot.x;
int y = p.y - hot.y;
int width = drop.getWidth();
int height = drop.getHeight();
vertical = new Leading(y - insets.top, height, spring);
horizontal = pair.vQuart.anchor.createHoveredAxis(drop,
new Rectangle(x, y, width, height));
} else if (pair.hQuart != null && pair.vQuart == null) {
int x = p.x - hot.x;
int y = pair.hQuart.masc - hot.y;
int width = drop.getWidth();
int height = drop.getHeight();
horizontal = new Leading(x - insets.left, width, spring);
vertical = pair.hQuart.anchor.createHoveredAxis(drop,
new Rectangle(x, y, width, height));
} else if (pair.hQuart != null && pair.vQuart != null) {
int x = pair.vQuart.masc - hot.x;
int y = pair.hQuart.masc - hot.y;
int width = drop.getWidth();
int height = drop.getHeight();
vertical = pair.hQuart.anchor.createHoveredAxis(drop,
new Rectangle(x, y, width, height));
horizontal = pair.vQuart.anchor.createHoveredAxis(drop,
new Rectangle(x, y, width, height));
}
assert vertical != null && horizontal != null;
Constraints constraints = new Constraints(horizontal, vertical);
container.add(drop, constraints);
}
last_point = null;
return true;
}