main-axis
-
The axis which is parallel with the side of the
target
that thepopover
is laid out upon. If thepopover
is left or right of thetarget
then themain-axis
is horizontal. If thepopover
is above or below thetarget
then themain-axis
is vertical. cross-axis
-
The axis which is counter to the
main-axis
. zone
-
The maximum-sized rectangle in a particular direction between one side of the
target
and thewindow bounds
. There are four possiblezones
therefore:top
right
bottom
left
. target
-
The element that the
popover
calculates its position relative to. docking edge
-
The edge of
body
that is closest totarget
or vice-versa.
-
The
popover
MUST reference a target. -
The
popover
MUST have a body whose contents may be any view.-
The
body
should autosize to the dimensions of its contents. -
body bounds
MUSNT exceedwindow bounds
. -
There SHOULD be a small visual gap between the respective boundaries of
body
andwindow
. -
The
body
MUST bias toward cross-axis centre-alignment with thetarget’s centre `registration point
up until such movement would break requirement2.ii
. -
The
docking edge
of thebody
must be sufficiently spaced fromtarget
to fittip
.
-
-
The
popover
MUST automatically choose to layout in one of the four zones. The selectedzone
MUST be the one with the largest area.-
A
zone
preference MAY be given so that if multiplezone
areas can wholly fit thepopover
one can be chosen over others even if it is of a lesser area.
-
-
The
popover
MUST have a tip that is connected to thebody
and points to the centre registration point of thetarget’s `docking edge
.-
The
tip
should automatically position itself on thebody’s `docking edge
. -
The
tip
should bias toward centre-alignment of itself on thecross-axis
up to such a point that it does not exceed thebody bounds
. -
If the
body bounds
have reachedwindow bounds
then thetip
should slide along its owncross-axis
until it reaches either centre-alignment withtarget
orbody
bounds first. -
The
tip
SHOULD be an equilateral triangle shape until doing so would no longer allow it to fit withinbody bounds
. At that point it MUST be a right-angle triangle with the hypotenuse oriented toward the oppositecross-axis
end ofbody
.
-
-
When the
target position
ortarget bounds
orwindow bounds
change thepopover
should recalculate itsbody
andtip
layout. -
When the
window bounds
change thepopover
should recalculate itsbody
andtip
position.
-
Behaviour of what to do when
target
exitswindow bounds
is undefined. -
A
zone
preference is only eligible when multiplezones
wholly fit thebody
. A more sophisticated algorithm could account for percentage-fit such that azone
would be used even if it did not wholly fitbody
and even while otherzones
do. -
Layout thrashing of
body
changing zones can be mitigated by hysteresis and/or throttling techniques but is not specified here. -
Only behaviour for rectangular
target
andpopovers
are specified.