Skip to main content

contain_rect

Function contain_rect 

Source
pub fn contain_rect(inner: Rect, bounds: Rect) -> Rect
Expand description

Translate inner minimally so it lies within bounds — shifting, not shrinking. On an axis where inner is larger than bounds, it is centered. Used to keep a block’s icon inside the block.