summaryrefslogtreecommitdiffstats
path: root/native/src/widget/text_input.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-11 05:13:56 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-11 05:13:56 +0200
commit0e2fc99eb864800d2d1522c015054d84cad078f4 (patch)
tree704cbd64852a31055cbb8b873db5c8a457107f13 /native/src/widget/text_input.rs
parent898307e9ac8e11de275d7d4d58b93a6f24a1e800 (diff)
downloadiced-0e2fc99eb864800d2d1522c015054d84cad078f4.tar.gz
iced-0e2fc99eb864800d2d1522c015054d84cad078f4.tar.bz2
iced-0e2fc99eb864800d2d1522c015054d84cad078f4.zip
Use `f32` for `Icon::size` and remove unnecessary conversions
Diffstat (limited to 'native/src/widget/text_input.rs')
-rw-r--r--native/src/widget/text_input.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 575f4436..95e3b720 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -51,7 +51,7 @@ pub struct Icon<Font> {
/// The unicode code point that will be used as the icon.
pub code_point: char,
/// Font size of the content.
- pub size: Option<u16>,
+ pub size: Option<f32>,
/// Position of the icon.
pub position: IconPosition,
}
@@ -886,7 +886,7 @@ pub fn draw<Renderer>(
position,
} = icon;
- let padding = f32::from(padding.horizontal());
+ let padding = padding.horizontal();
let size = size.unwrap_or_else(|| renderer.default_size());
let width = renderer.measure_width(
&code_point.to_string(),
@@ -939,14 +939,14 @@ pub fn draw<Renderer>(
position,
} = icon;
- let padding = f32::from(padding.horizontal());
+ let padding = padding.horizontal();
let size = size.unwrap_or_else(|| renderer.default_size());
let width =
renderer.measure_width(&code_point.to_string(), size, font.clone());
renderer.fill_text(Text {
content: &code_point.to_string(),
- size: f32::from(size),
+ size,
font: font.clone(),
color: appearance.icon_color,
bounds: Rectangle {
@@ -954,8 +954,8 @@ pub fn draw<Renderer>(
IconPosition::Left => bounds.x + width + padding,
IconPosition::Right => bounds.x + bounds.width - padding,
},
- y: bounds.center_y() - f32::from(size) / 2.0,
- height: f32::from(size),
+ y: bounds.center_y() - size / 2.0,
+ height: size,
..bounds
},
horizontal_alignment: alignment::Horizontal::Right,