wu = tx - wu;
wm = tx - wm;
er = trx + er;
eu = trx + eu;
em = trx + em;
WidgetAdapter dropAdapter = WidgetAdapter.getWidgetAdapter(todrop);
int tm = target.getWidth() / 2;
int sm = todrop.getWidth() / 2;
int dx = this_point.x - dropAdapter.getHotspotPoint().x;
int drx = dx + todrop.getWidth();
tm = tx + tm;
sm = dx + sm;
int thisy = this_point.y - dropAdapter.getHotspotPoint().y;
int thisb = thisy + todrop.getHeight();
int targetx = target.getX();
int targetr = targetx + target.getWidth();
int targety = target.getY();
int targetb = targety + target.getHeight();
int targeti = targetx + indent;
int miny = Math.min(thisy, targety) - ANCHOR_EXT;
int maxb = Math.max(thisb, targetb) + ANCHOR_EXT;
if (Math.abs(tm - sm) < THRESHOLD_DISTANCE) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalCenterAnchor(target);
Quartet trio = new Quartet(tm, tm - todrop.getWidth() / 2 + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(dx - targetx) < THRESHOLD_DISTANCE) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalLeftAlignAnchor(target);
Quartet trio = new Quartet(targetx, targetx + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(dx - targeti) < THRESHOLD_DISTANCE && (Math.abs(thisy - sr) < THRESHOLD_DISTANCE || Math.abs(thisy - su) < THRESHOLD_DISTANCE)) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalIndentAnchor(target);
Quartet trio = new Quartet(targeti, targeti + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(drx - targetr) < THRESHOLD_DISTANCE) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalRightAlignAnchor(target);
Quartet trio = new Quartet(targetr, targetr - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(drx - wr) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalLeftRelatedAnchor(target);
Quartet trio = new Quartet(wr, wr - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(drx - wu) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalLeftRelatedAnchor(target);
Quartet trio = new Quartet(wr, wr - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalLeftUnrelatedAnchor(target);
trio = new Quartet(wu, wu - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(drx - wm) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalLeftRelatedAnchor(target);
Quartet trio = new Quartet(wr, wr - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalLeftUnrelatedAnchor(target);
trio = new Quartet(wu, wu - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalLeftLargeAnchor(target);
trio = new Quartet(wm, wm - todrop.getWidth() + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(dx - er) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalRightRelatedAnchor(target);
Quartet trio = new Quartet(er, er + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(dx - eu) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalRightRelatedAnchor(target);
Quartet trio = new Quartet(er, er + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalRightUnrelatedAnchor(target);
trio = new Quartet(eu, eu + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
} else if (Math.abs(dx - em) < THRESHOLD_DISTANCE && thisy <= targetb && thisb >= targety) {
List<Quartet> list = new ArrayList<Quartet>();
Anchor a = new VerticalRightRelatedAnchor(target);
Quartet trio = new Quartet(er, er + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalRightUnrelatedAnchor(target);
trio = new Quartet(eu, eu + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
a = new VerticalRightLargeAnchor(target);
trio = new Quartet(em, em + dropAdapter.getHotspotPoint().x, miny, maxb, a);
list.add(trio);
return list;
}
return null;
}