Module floating_layer
Expand description
Where the floating layer’s cards stand, as plain arithmetic.
The session hosts one floating layer: every activity the person keeps over the windows is a card in it. This module is the layer’s placement as a pure function, so what a frame draws can be proven from numbers alone: cards never overlap each other, never sit under the bar, inside the notification column while a banner shows, or in the band the hardware readout stands in, and always keep a reachable strip inside the work area.
Apps describe, the session places: nothing here knows what an activity is
beyond its Summary.
Structs§
- Card
- One activity the layer holds, and where the person left it when they dragged it loose.
- Folded
- A card the layer leaves in the pill.
- Layer
- What the layer shows.
- Named
- An activity the bar’s pill names: the app that shows it and its summary. An activity’s id is its own app’s, so the app is part of what names it.
- Parts
- Where the parts of a card stand on it, as the frame draws them.
- Pill
- What the bar’s pill shows: the activity that stands first, and how many others are waiting behind it (one dot each).
- Placed
- A card as the layer draws it.
- Placement
- The screen the cards stand on, in the layer’s own coordinates: the work area under the bar, the bar itself, the notification column while a banner shows, and the band the readout stands in while it does.
Enums§
- Corner
- Which corner of the work area the cards dock in. It is the person’s choice on this device, never shared.
- Fold
Reason - Why a card is not on the screen.
Constants§
- CARD_
GAP - The space between two docked cards.
- EDGE_
INSET - How far a card rests from the work area’s edges.
- MAX_
CARDS - The most cards expanded at once; the least recently touched folds into the pill when another arrives.
- NARROW_
PX - Below this width a display is phone-width: the pill is the only resting form and a card only drops when the person expands it.
- REACHABLE
- The least a card keeps inside the work area, whatever the person dragged it to: enough to grab it again.
Functions§
- card_
extent - How big
cardstands onwork: every card in a column is as wide as the layer’s one column, so the cards share a width and an edge, and the layer’s place wins over what its app asked for. A card its app draws keeps the height its app asked for; every other card the height its summary’s rows take. The app lays its body out at the width the layer’s place gives it. - card_
parts - Where each of
summary’s parts stands on a card incard: the rowscard_sizereserves, laid out whatever the card’s real height. - card_
size - How big an activity’s card is on
work: one token’s width (a hero picture takes its own), never wider than the display, and the height of the rows the summary has, so a card is as tall as what it says and no taller. - keep_
inside - A card the size of
sizedragged toat, kept insideworkandinsetfrom its edges but for a stripreachablelong the person can grab: a card that fits stays wholly inside, a card larger than the work area keeps that strip. Every place a card is dropped ends here, so a settled card and a remembered one land the same way. - narrow
- Whether
workis a phone-width display. - pill
- The bar’s pill: the most urgent activity, and how many others wait behind it. A call stands before directions, directions before a timer that is due within a minute, that timer before any other timer, timers before music.
- place
- Where the cards stand:
corner’s column, in priority order from the corner, or — phone-width andexpanded— one full-width card under the bar.