Fix cursor and hover styles changing when dragging the mouse

This commit is contained in:
Mikayla 2023-08-23 17:47:03 -07:00
parent 1320fadc30
commit 4d2f5a8e04
No known key found for this signature in database
3 changed files with 26 additions and 15 deletions

View file

@ -42,7 +42,11 @@ where
let mut handler = MouseEventHandler::above::<Tag, _>(region_id, cx, |state, cx| {
// Observing hovered will cause a render when the mouse enters regardless
// of if mouse position was accessed before
let drag_position = if state.hovered() { drag_position } else { None };
let drag_position = if state.dragging() {
drag_position
} else {
None
};
Stack::new()
.with_child(render_child(state, cx))
.with_children(drag_position.map(|drag_position| {