fix: request redraw when hover state changes
This commit is contained in:
parent
dc1cf9f00c
commit
1ac21a9d99
1 changed files with 13 additions and 0 deletions
|
|
@ -868,8 +868,21 @@ pub fn update<'a, Message: Clone>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Event::Mouse(mouse::Event::CursorMoved { .. })
|
||||||
|
| Event::Touch(touch::Event::FingerMoved { .. }) => {
|
||||||
|
let state = state();
|
||||||
|
let is_hovered = cursor.is_over(layout.bounds());
|
||||||
|
if state.is_hovered != is_hovered {
|
||||||
|
state.is_hovered = is_hovered;
|
||||||
|
shell.request_redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
Event::Touch(touch::Event::FingerLost { .. }) | Event::Mouse(mouse::Event::CursorLeft) => {
|
Event::Touch(touch::Event::FingerLost { .. }) | Event::Mouse(mouse::Event::CursorLeft) => {
|
||||||
let state = state();
|
let state = state();
|
||||||
|
|
||||||
|
if state.is_hovered || state.is_pressed {
|
||||||
|
shell.request_redraw();
|
||||||
|
}
|
||||||
state.is_hovered = false;
|
state.is_hovered = false;
|
||||||
state.is_pressed = false;
|
state.is_pressed = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue