Merge pull request #2143 from iced-rs/fix/tooltip-layout-invalidation
Invalidate layout when `Tooltip` changes `overlay`
This commit is contained in:
commit
100d15f306
1 changed files with 9 additions and 1 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue