Invalidate layout when Tooltip changes overlay

This commit is contained in:
Héctor Ramón Jiménez 2023-11-21 18:11:31 +01:00
parent 7dd32f3be4
commit f67387f2d8
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -157,11 +157,19 @@ where
) -> event::Status { ) -> event::Status {
let state = tree.state.downcast_mut::<State>(); let state = tree.state.downcast_mut::<State>();
let was_idle = *state == State::Idle;
*state = cursor *state = cursor
.position_over(layout.bounds()) .position_over(layout.bounds())
.map(|cursor_position| State::Hovered { cursor_position }) .map(|cursor_position| State::Hovered { cursor_position })
.unwrap_or_default(); .unwrap_or_default();
let is_idle = *state == State::Idle;
if was_idle != is_idle {
shell.invalidate_layout();
}
self.content.as_widget_mut().on_event( self.content.as_widget_mut().on_event(
&mut tree.children[0], &mut tree.children[0],
event, event,
@ -289,7 +297,7 @@ pub enum Position {
Right, Right,
} }
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, PartialEq, Default)]
enum State { enum State {
#[default] #[default]
Idle, Idle,