Skip to main content

spacing

Function spacing 

Source
pub fn spacing(surface: &Surface, density: Density) -> Spacing
Expand description

egui’s spacing, from the relational scale.

The mapping is nearly one for one. item_spacing separates controls of a kind, so Gap::Peer across and Gap::Bound down, because a stacked row sits closer to its neighbour than a side-by-side one does. button_padding is the distance from a button’s edge to its label, Peer across and a hair down because a button is wider than it is tall. window_margin is a panel’s inner margin, which is a group. indent offsets a child from its parent, a hierarchy rather than a separation, so it is the width that reads as one pane at this type size.

interact_size.y is the one number here that is not a relationship: it is the target floor, and it is a minimum rather than a size. The width is left at egui’s own, which is about DragValue and friends; forcing it on every control would stretch a one-word button for nothing a reader gains.