diff options
| author | 2024-11-04 23:29:37 +0100 | |
|---|---|---|
| committer | 2024-11-05 23:52:59 +0100 | |
| commit | 03bffe3db61b51d9e28f42c5bfea421b5612c484 (patch) | |
| tree | 630cba5e59e8d383d4b63c63b87830ccce7de60b | |
| parent | fec75221f9e7e19f9ad9a00de0fde6f205c2d92b (diff) | |
| download | iced-03bffe3db61b51d9e28f42c5bfea421b5612c484.tar.gz iced-03bffe3db61b51d9e28f42c5bfea421b5612c484.tar.bz2 iced-03bffe3db61b51d9e28f42c5bfea421b5612c484.zip  | |
Fix `pick_list` not requesting a redraw when open
| -rw-r--r-- | widget/src/pick_list.rs | 23 | 
1 files changed, 15 insertions, 8 deletions
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index 32f859da..6708e7cd 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -518,12 +518,16 @@ where              _ => {}          }; -        let status = if state.is_open { -            Status::Opened -        } else if cursor.is_over(layout.bounds()) { -            Status::Hovered -        } else { -            Status::Active +        let status = { +            let is_hovered = cursor.is_over(layout.bounds()); + +            if state.is_open { +                Status::Opened { is_hovered } +            } else if is_hovered { +                Status::Hovered +            } else { +                Status::Active +            }          };          if let Event::Window(window::Event::RedrawRequested(_now)) = event { @@ -824,7 +828,10 @@ pub enum Status {      /// The [`PickList`] is being hovered.      Hovered,      /// The [`PickList`] is open. -    Opened, +    Opened { +        /// Whether the [`PickList`] is hovered, while open. +        is_hovered: bool, +    },  }  /// The appearance of a pick list. @@ -898,7 +905,7 @@ pub fn default(theme: &Theme, status: Status) -> Style {      match status {          Status::Active => active, -        Status::Hovered | Status::Opened => Style { +        Status::Hovered | Status::Opened { .. } => Style {              border: Border {                  color: palette.primary.strong.color,                  ..active.border  | 
