pub enum ResizeMode {
Cover,
Contain,
Stretch,
Center,
ScaleDown,
}Expand description
How an image fits its box.
Variants§
Cover
Fill the box, cropping (default).
Contain
Fit inside the box, letterboxing.
Stretch
Stretch to the box.
Center
Center at natural size, cropped where larger than the box (CSS’s
object-fit: none).
ScaleDown
Center at natural size, shrunk to fit the box where larger (CSS’s
object-fit: scale-down, React Native’s center).
Implementations§
Source§impl ResizeMode
impl ResizeMode
Sourcepub fn fit(
self,
natural: Size<Points>,
size: Size<Points>,
position: ObjectPosition,
) -> Bounds<Points>
pub fn fit( self, natural: Size<Points>, size: Size<Points>, position: ObjectPosition, ) -> Bounds<Points>
Where content of natural size goes in a box of size: scaled as
the mode scales it (Center keeps the natural size, as CSS’s
none; ScaleDown shrinks content larger than the box, as CSS’s
scale-down), then placed at position. The rectangle
may reach outside the box (a covering image), which crops it.
Content without a size fills the box.
Trait Implementations§
Source§impl Clone for ResizeMode
impl Clone for ResizeMode
impl Copy for ResizeMode
Source§impl Debug for ResizeMode
impl Debug for ResizeMode
Source§impl Default for ResizeMode
impl Default for ResizeMode
impl Eq for ResizeMode
Source§impl HostValue for ResizeMode
impl HostValue for ResizeMode
Source§impl IntoReactive<ResizeMode> for ResizeMode
impl IntoReactive<ResizeMode> for ResizeMode
Source§fn into_reactive(self) -> Reactive<ResizeMode>
fn into_reactive(self) -> Reactive<ResizeMode>
As a
Reactive.Source§impl JsValue for ResizeMode
impl JsValue for ResizeMode
Source§impl PartialEq for ResizeMode
impl PartialEq for ResizeMode
Source§impl PropEnum for ResizeMode
impl PropEnum for ResizeMode
impl StructuralPartialEq for ResizeMode
Auto Trait Implementations§
impl Forget for ResizeMode
impl Freeze for ResizeMode
impl Move for ResizeMode
impl RefUnwindSafe for ResizeMode
impl Send for ResizeMode
impl Sync for ResizeMode
impl Unpin for ResizeMode
impl UnsafeUnpin for ResizeMode
impl UnwindSafe for ResizeMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CallbackArgs for Twhere
T: Ret,
impl<T> CallbackArgs for Twhere
T: Ret,
Source§fn ts_params(types: &mut TsTypes, names: &[&str]) -> String
fn ts_params(types: &mut TsTypes, names: &[&str]) -> String
Its TypeScript parameters, named
names (name: string, amount: number), or without names value for one and a, b, … for
several.Source§fn into_js_args<'a>(
self,
host: &'a dyn JsHost,
) -> Result<Vec<JsOwned<'a>>, PropError>
fn into_js_args<'a>( self, host: &'a dyn JsHost, ) -> Result<Vec<JsOwned<'a>>, PropError>
The arguments as JS values.