pub struct SizeClass {
pub width: WidthClass,
pub height: HeightClass,
}Expand description
A window’s size class (docs/size-classes.md), reported by the backend and read by apps
through day::size_class().
Per-window, not per-app: two windows of one process can sit in different classes at the same time (a narrow and a wide window side by side, iPadOS Stage Manager, Android split-screen), and an app that keyed off a single global would lay the second window out for the first one’s size.
Fields§
§width: WidthClass§height: HeightClassImplementations§
Source§impl SizeClass
impl SizeClass
Sourcepub const SPLIT_MIN_WIDTH: f64 = 600.0
pub const SPLIT_MIN_WIDTH: f64 = 600.0
The Compact/Medium width boundary in dp: the narrowest window where a second
pane starts to fit. Backends that hand an adaptive container its pane widths derive
them from this (Android’s list + minimum-detail widths sum to it), so the platform’s
measure-time decision and this table agree by construction (docs/size-classes.md).
Sourcepub fn from_size(width: f64, height: f64) -> Self
pub fn from_size(width: f64, height: f64) -> Self
Bucket a window’s size in points. The one place the breakpoint numbers appear.
Sourcepub fn prefers_split(self) -> bool
pub fn prefers_split(self) -> bool
Whether a two-pane presentation fits. The rule behind an automatic
props::NavPresentation: anything wider than compact gets both panes.