Skip to content

Commit

Permalink
Invalidate layout when Tooltip changes overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 21, 2023
1 parent 7dd32f3 commit f67387f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion widget/src/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,19 @@ where
) -> event::Status {
let state = tree.state.downcast_mut::<State>();

let was_idle = *state == State::Idle;

*state = cursor
.position_over(layout.bounds())
.map(|cursor_position| State::Hovered { cursor_position })
.unwrap_or_default();

let is_idle = *state == State::Idle;

if was_idle != is_idle {
shell.invalidate_layout();
}

self.content.as_widget_mut().on_event(
&mut tree.children[0],
event,
Expand Down Expand Up @@ -289,7 +297,7 @@ pub enum Position {
Right,
}

#[derive(Debug, Clone, Copy, Default)]
#[derive(Debug, Clone, Copy, PartialEq, Default)]
enum State {
#[default]
Idle,
Expand Down

0 comments on commit f67387f

Please sign in to comment.