Use Pixels for spacing

This commit is contained in:
Héctor Ramón Jiménez 2023-02-17 16:23:29 +01:00
parent fd3a141024
commit a467a037c3
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
6 changed files with 51 additions and 58 deletions

View file

@ -53,7 +53,7 @@ where
label: String,
width: Length,
size: f32,
spacing: u16,
spacing: f32,
text_size: Option<f32>,
font: Renderer::Font,
icon: Icon<Renderer::Font>,
@ -69,7 +69,7 @@ where
const DEFAULT_SIZE: f32 = 20.0;
/// The default spacing of a [`Checkbox`].
const DEFAULT_SPACING: u16 = 15;
const DEFAULT_SPACING: f32 = 15.0;
/// Creates a new [`Checkbox`].
///
@ -114,8 +114,8 @@ where
}
/// Sets the spacing between the [`Checkbox`] and the text.
pub fn spacing(mut self, spacing: u16) -> Self {
self.spacing = spacing;
pub fn spacing(mut self, spacing: impl Into<Pixels>) -> Self {
self.spacing = spacing.into().0;
self
}