pax icon indicating copy to clipboard operation
pax copied to clipboard

Image fit attribute

Open samuelselleck opened this issue 9 months ago • 0 comments

This adds an optional parameter "fit" to images that allows for different modes of sizing to bounds:

/// Image fit/layout options
#[pax]
pub enum ImageFit {
    /// Scale the image to perfectly fit within it's bounds vertically
    FillVertical,
    /// Scale the image to perfectly fit within it's bounds horizontally
    FillHorizontal,
    /// Scale the image to perfectly fit within it's bounds, choosing vertical or horizontal
    /// based on which of them makes it fill the container, possibly clipping parts of the image
    Fill,
    /// Scale the image to perfectly fit within it's bounds, without clipping the image, possibly leaving some
    /// of the available container area embty.
    #[default]
    Fit,
    /// Stretch the image to fit the container
    Stretch,
}

samuelselleck avatar May 16 '24 23:05 samuelselleck