pub enum Density {
Compact,
Relaxed,
}Expand description
How much room an interactive widget’s hit target should claim.
Not itself consulted by anything in this crate: there are no built-in
interactive widgets yet to apply it to; every widget here is a free
function or a thin, stateless composition of one (see the crate’s module
docs). It exists so an app choosing between a phone-sized and a
desktop-sized layout has one place to ask “how big should this
button/row/slider be”, rather than inventing its own ad hoc breakpoint
constants per widget (as e.g. responsive_game_ui’s own
MIN_TARGET_W/MIN_TARGET_H do today). A future interactive widget in
this crate (a checkbox, say) would read min_target_size
the same way it would read Sense.
Variants§
Compact
Smaller interactive targets, for narrow or short terminals, or touch input where every cell of screen space is scarce.
Relaxed
Larger interactive targets, comfortable to hit with a mouse on a normal desktop-sized terminal.
Implementations§
Source§impl Density
impl Density
Sourcepub const fn min_target_size(self) -> Size
pub const fn min_target_size(self) -> Size
The minimum size, in cells, an interactive target should claim at this density.
Counter-intuitively, Compact targets are taller
than Relaxed ones, not shorter: “compact” here
means a narrow, likely touch-driven layout (a phone-width terminal,
say), where a fingertip needs a noticeably taller row than a mouse
pointer does, at the cost of showing fewer rows at once.
Relaxed assumes a normal desktop terminal with a
mouse, where dense, single-line rows are both legible and easy to
click precisely.