ComprehensiveOffsetPositions constant

List<List<RelativePosition>> const ComprehensiveOffsetPositions

Comprehensive offset positions; contains all positions that are immediately adjacent to but not overlapping the target.

For corners, we just reuse the already-existing OffsetPositions. For positions adjacent to the edges, we define a bunch of Adjacent positions. The whole set looks like:

      AB  C  DE
      P+-----+F
       |     |
       |     |
      O|     |G
       |     |
       |     |
      N+-----+H
      ML  K  JI

A: OffsetTopLeft B: AdjacentTopLeft C: AdjacentTop D: AdjacentTopRight E: OffsetTopRight F: AdjacentRightTop G: AdjacentRight H: AdjacentRightBottom I: OffsetBottomRight J: AdjacentBottomRight K: AdjacentBottom L: AdjacentBottomLeft M: OffsetBottomLeft N: AdjacentLeftBottom O: AdjacentLeft P: AdjacentLeftTop

Note that the list of positions are listed here in priority order for hovercard positioning; which is probably a sane default for most basic pop-ups. That ordering tries all cardinal directions, then the other non- corner alignments, and finally the corners.

Implementation

static const ComprehensiveOffsetPositions = [
  // cardinal directions
  AdjacentCardinal,
  // edges
  AdjacentTopEdge,
  AdjacentRightEdge,
  AdjacentBottomEdge,
  AdjacentLeftEdge,
  // corners
  OffsetPositions,
];