Skip to content

Commit

Permalink
Fix pick_list not requesting a redraw when open
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 5, 2024
1 parent fec7522 commit 03bffe3
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions widget/src/pick_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 03bffe3

Please sign in to comment.