roll back mouse position in mouse_state struct in favor of using the dragged element position

This commit is contained in:
K Simmons 2022-10-22 21:58:14 -07:00
parent 8cde64d3f6
commit f5795ffc6f
6 changed files with 10 additions and 29 deletions

View file

@ -33,7 +33,7 @@ where
.global::<DragAndDrop<Workspace>>()
.currently_dragged::<DraggedItem>(cx.window_id())
.filter(|_| hovered)
.map(|_| state.mouse_position());
.map(|(drag_position, _)| drag_position);
Stack::new()
.with_child(render_child(state, cx))
@ -69,6 +69,15 @@ where
cx.notify();
}
})
.on_move(|_, cx| {
if cx
.global::<DragAndDrop<Workspace>>()
.currently_dragged::<DraggedItem>(cx.window_id())
.is_some()
{
cx.notify();
}
})
}
pub fn handle_dropped_item(