DropletCutoutWrap
Droppy's one rule for content near the camera cutout: it either rides beside the cutout or starts just under it.
enum DropletCutoutWrap
Every surface Droppy draws under a notch or the camera island decides it the same way, built-in and droplet alike: the island notification pill, cards, pop-ups, the recording island, shelf widget header rows and droplet widgets. The surface keeps its own width (the island's width on a notched Mac too) and is never widened to make room beside the cutout.
- When what has to ride beside the cutout fits in the band left and right of it, at least
clearanceUnderCutoutclear of the cutout, it wraps: the two halves sit beside the cutout. - Otherwise nothing sits beside it: the content's first ink starts
clearanceUnderCutoutunder the cutout's floor. No empty band.
A MacBook's notch is about three and a half times the camera island's pill, so the same row often wraps on the camera island and hangs under the notch. Droppy itself calls this function, so a droplet that asks it gets the host's answer:
// `geometry` is the display's DropletNotchGeometry.
let wraps = geometry.cutout != .none && DropletCutoutWrap.fitsBesideCutout(
surfaceWidth: cardWidth,
cutoutWidth: geometry.closedWidth,
besideExtent: leadingInset + titleWidth
)A shelf widget does not call it: it declares how far its header's halves reach from the card's edge (besideExtent) and the host decides with this function at the card's width, the card centred on the cutout, handing the result down in notchWrap, with the band ending clearanceUnderCutout short of the cutout. Hosts before 1.26.0 used their own band test (the band at least the larger of the declared number and 64 points).
Available from DroppyKit 1.26.0. Optional API: a droplet that weak-links DroppyKit checks #_hasSymbol(DropletCutoutWrap.self) and keeps its own layout on an older host.
Type properties
clearanceUnderCutout
static let clearanceUnderCutout: CGFloat
The clearance between the cutout and what Droppy draws around it, in points: beside the cutout, and between its floor and the cap top of the first line under it. 5 points, everywhere.
Type methods
bandBesideCutout(surfaceWidth:cutoutWidth:)
static func bandBesideCutout(surfaceWidth: CGFloat, cutoutWidth: CGFloat) -> CGFloat
The width left for content on each side of a centred cutout, from the surface's edge to clearanceUnderCutout short of the cutout.
- Parameters:
- surfaceWidth: The surface's own width, never widened for the wrap.
- cutoutWidth: The cutout's width on this display: the notch, or the camera island's pill (
closedWidth). - Returns: The band's width, which is negative when the cutout is as wide as the surface.
fitsBesideCutout(surfaceWidth:cutoutWidth:besideExtent:)
static func fitsBesideCutout(surfaceWidth: CGFloat, cutoutWidth: CGFloat, besideExtent: CGFloat) -> Bool
Whether content that reaches besideExtent from the surface's edge fits beside a centred cutout, at least clearanceUnderCutout clear of it.
When it does, the content wraps the cutout; when it does not, it starts clearanceUnderCutout under the cutout's floor.
- Parameters:
- surfaceWidth: The surface's own width, never widened for the wrap.
- cutoutWidth: The cutout's width on this display.
- besideExtent: How far the wider of the two halves reaches from the surface's edge, its leading inset included.