Create ferris example to showcase ContentFit and Rotation

This commit is contained in:
Héctor Ramón Jiménez 2024-05-02 17:14:20 +02:00
parent 610394b695
commit efc55b655b
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 234 additions and 1 deletions

View file

@ -1,6 +1,8 @@
//! Control the fit of some content (like an image) within a space.
use crate::Size;
use std::fmt;
/// The strategy used to fit the contents of a widget to its bounding box.
///
/// Each variant of this enum is a strategy that can be applied for resolving
@ -118,3 +120,15 @@ impl ContentFit {
}
}
}
impl fmt::Display for ContentFit {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
ContentFit::Contain => "Contain",
ContentFit::Cover => "Cover",
ContentFit::Fill => "Fill",
ContentFit::None => "None",
ContentFit::ScaleDown => "Scale Down",
})
}
}