edge-tab
In a headset, a panel that would go out of view is drawn as its header: a rounded tab at the edge of what you can see, on the side the panel went. Turn back toward it and it opens again where it was. Tap the tab and the panel comes to where you are looking.
This matters most on glasses with a narrow window, such as optical see-through AR, where the picture covers a small part of what you see. There a panel cut off by the edge of the display shows you where the display ends: you see the window you are looking through. It also matters on a wide headset, where a panel behind you is otherwise somewhere you have to remember.
Panels opened from the system bar, the settings panel and the system bar
itself do this in a headset, as does any frame panel given edgeTab. The
bar's tab opens the bar as a ring where you are looking.
When a panel becomes a tab
Measured in the headset's own view, the narrower of the two eyes on each side, so a tab is never in one eye only.
- A panel that fits in view becomes a tab when more than a tenth of it would
be past an edge (
EDGE_TAB_OVERHANG), and opens again when all of it fits with a margin to spare (EDGE_TAB_MARGIN). The gap between the two keeps a panel at the edge from flickering. - A panel bigger than the view, on either axis, stays open while the middle of the view is on it, since it can never fit.
- A panel behind you, or beside you, is a tab.
A frame panel (a system panel, or any given edgeTab) that would open out
of view, as a tab, does not: it turns into view by the least it can
(turnIntoView), across first and then up or down, so a panel placed low in
the view (a HUD) opens at the bottom of what you can see rather than in the
middle of it. Only one that cannot fit (behind you, or bigger than the view)
comes to where you are looking. The settings panel, opened to be used, comes
to where you are looking.
The tab is at the panel's distance, so it sits about as deep as the panel, and
the same angular size wherever it is (about 2.6° tall). It points toward the
middle of the panel, along the line from the middle of the view. Two tabs on
one edge stand side by side. A tab at the top stands further in
(EDGE_TAB_TOP_INSET): the top of a headset's view is the hardest to see.
Using it
attachEdgeTab(scene, { title, icon, handleTap, drawScene }) returns
{ update(panel), hide(), collapsed, intoView(margin), mesh, dispose() }.
Call update each frame with the panel's plane (its corners are read from
its bounds). It returns true while the panel should be hidden and the tab
shown; intoView is then the least turn that would bring the panel into view. A frame
panel takes edgeTab: { title } and does all of this itself, in a session
only; its default handleTap brings it to your gaze.
attachEdgeTab is in the barrel. The rule is pure and lives in this module
(tosijs-3d/edge-tab: panelExtent, edgeCollapsed, turnIntoView,
edgeTabSpot, edgeTabAvoid, tabRect, fitTab), in tangents of the head's view, so it
can be tested without a headset. A tab is fitted by its real corners: off the
axis of a wide headset it covers nearly twice the tangent its size suggests.