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,5 +1,5 @@
//! Control the rotation of some content (like an image) within a space.
use crate::{Radians, Size};
use crate::{Degrees, Radians, Size};
/// The strategy used to rotate the content.
///
@ -31,6 +31,11 @@ impl Rotation {
}
}
/// Returns the angle of the [`Rotation`] in [`Degrees`].
pub fn degrees(self) -> Degrees {
Degrees(self.radians().0.to_degrees())
}
/// Rotates the given [`Size`].
pub fn apply(self, size: Size) -> Size {
match self {