fix: wrong size variant in sizable trait (#493)

This commit is contained in:
reya 2024-12-17 08:22:48 +07:00 committed by GitHub
parent 5874c6974f
commit 8260b5f6a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -208,6 +208,7 @@ pub trait Disableable {
} }
/// A trait for setting the size of an element. /// A trait for setting the size of an element.
/// Size::Medium is use by default.
pub trait Sizable: Sized { pub trait Sizable: Sized {
/// Set the ui::Size of this element. /// Set the ui::Size of this element.
/// ///
@ -215,17 +216,17 @@ pub trait Sizable: Sized {
/// Or a `Pixels` to set a custom size: `px(30.)` /// Or a `Pixels` to set a custom size: `px(30.)`
fn with_size(self, size: impl Into<Size>) -> Self; fn with_size(self, size: impl Into<Size>) -> Self;
/// Set to Size::Small
fn small(self) -> Self {
self.with_size(Size::Small)
}
/// Set to Size::XSmall /// Set to Size::XSmall
fn xsmall(self) -> Self { fn xsmall(self) -> Self {
self.with_size(Size::XSmall) self.with_size(Size::XSmall)
} }
/// Set to Size::Medium /// Set to Size::Small
fn small(self) -> Self {
self.with_size(Size::Small)
}
/// Set to Size::Large
fn large(self) -> Self { fn large(self) -> Self {
self.with_size(Size::Large) self.with_size(Size::Large)
} }