#[non_exhaustive]pub enum Fit {
Natural,
Cover,
Contain,
}Expand description
How a picture sits in the box it is given.
An intent rather than a value, so a renderer picks the expression it has:
object-fit in a webview, a texture’s UV rect in egui, and in a terminal a
choice about how many cells the blit gets. Named because MNW already makes
the distinction deliberately at 17 sites and makes it three different ways,
which is a policy the app decided rather than one a shared crate would be
picking by accident.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Natural
The picture’s own proportions, and the box takes the height they imply.
The default because it is the only one that shows the whole picture at
its own shape, so a renderer that ignores this enum entirely is still
right about the common case. A screenshot wants this; the shipped MNW
carousel sets no object-fit at all, which is this.
Cover
Fill the box and crop whatever does not fit.
For a picture in a slot whose shape the layout fixed: a thumbnail, an avatar, cover art. 15 of MNW’s 17 sites.
Contain
Fit inside the box whole, leaving space on two sides.
The letterbox. For when the whole picture matters more than filling the space, and the space is not the picture’s shape.