diff options
-rw-r--r-- | examples/tour/src/main.rs | 2 | ||||
-rw-r--r-- | native/src/widget/text_input.rs | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index 5edee850..6a1380d7 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -583,7 +583,7 @@ impl<'a> Step { text_input = text_input.icon(text_input::Icon { font: ICON_FONT, code_point: '\u{e900}', - size: Some(35), + size: Some(35.0), position: text_input::IconPosition::Right, }); } 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, |