- switch (anchor) {
- case "center": return [(x0 + x1) / 2, (y0 + y1) / 2];
- case "top": return [(x0 + x1) / 2, y1];
- case "bottom": return [(x0 + x1) / 2, y0];
- case "left": return [x0, (y0 + y1) / 2];
- case "right": return [x1, (y0 + y1) / 2];
-
- case "topleft": return [x0, y1];
- case "topright": return [x1, y1];
- case "bottomleft": return [x0, y0];
- case "bottomright": return [x0, y0];
- default: return [anchor[0], anchor[1]];
+ function (anchor, aabb) {
+ return anchorPoint(anchor, aabb.x0, aabb.y0, aabb.x1, aabb.y1);
+ },
+ function (anchor, x0, y0, x1, y1) {
+ switch (anchor) {
+ case "center": return [(x0 + x1) / 2, (y0 + y1) / 2];
+ case "top": return [(x0 + x1) / 2, y1];
+ case "bottom": return [(x0 + x1) / 2, y0];
+ case "left": return [x0, (y0 + y1) / 2];
+ case "right": return [x1, (y0 + y1) / 2];
+ case "topleft": return [x0, y1];
+ case "topright": return [x1, y1];
+ case "bottomleft": return [x0, y0];
+ case "bottomright": return [x0, y0];
+ default: return [anchor[0], anchor[1]];
+ }