From cf9d8e01048845ee503a62eb55e634a76a0e9163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Tue, 11 Apr 2023 05:54:51 +0200 Subject: [PATCH] Rename `IconPosition` to `Side` in `text_input` --- examples/tour/src/main.rs | 2 +- native/src/widget/text_input.rs | 18 +++++++++--------- src/widget.rs | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index 8a1b8d5a41..40ab33c2c3 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -585,7 +585,7 @@ impl<'a> Step { code_point: '\u{E900}', size: Some(35.0), spacing: 10.0, - position: text_input::IconPosition::Right, + side: text_input::Side::Right, }); } diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index c43b735c5f..bb3976453c 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -347,16 +347,16 @@ pub struct Icon { pub size: Option, /// The spacing between the [`Icon`] and the text in a [`TextInput`]. pub spacing: f32, - /// The position of the icon. - pub position: IconPosition, + /// The side of a [`TextInput`] where to display the [`Icon`]. + pub side: Side, } -/// The position of an [`Icon`]. +/// The side of a [`TextInput`]. #[derive(Debug, Clone)] -pub enum IconPosition { - /// Position the [`Icon`] on the left side of a [`TextInput`]. +pub enum Side { + /// The left side of a [`TextInput`]. Left, - /// Position the [`Icon`] on the right side of a [`TextInput`]. + /// The right side of a [`TextInput`]. Right, } @@ -448,8 +448,8 @@ where let mut icon_node = layout::Node::new(Size::new(icon_width, text_bounds.height)); - match icon.position { - IconPosition::Left => { + match icon.side { + Side::Left => { text_node.move_to(Point::new( padding.left + icon_width + icon.spacing, padding.top, @@ -457,7 +457,7 @@ where icon_node.move_to(Point::new(padding.left, padding.top)); } - IconPosition::Right => { + Side::Right => { text_node.move_to(Point::new(padding.left, padding.top)); icon_node.move_to(Point::new( diff --git a/src/widget.rs b/src/widget.rs index d3c160882f..c0ac716f17 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -124,7 +124,7 @@ pub mod text_input { //! Display fields that can be filled with text. pub use iced_native::widget::text_input::{ focus, move_cursor_to, move_cursor_to_end, move_cursor_to_front, - select_all, Appearance, Icon, IconPosition, Id, StyleSheet, + select_all, Appearance, Icon, Id, Side, StyleSheet, }; /// A field that can be filled with text.