Impl default for drag and drop global. Make drag and drop global maintain a list of weak handles to the container.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
K Simmons 2022-09-01 12:10:20 -07:00
parent bf6d3ad02d
commit 67a585cdfa
3 changed files with 40 additions and 21 deletions

View file

@ -949,8 +949,9 @@ impl Workspace {
status_bar
});
let drag_and_drop = DragAndDrop::new(cx.weak_handle(), cx);
cx.set_global(drag_and_drop);
cx.update_default_global::<DragAndDrop<Workspace>, _, _>(|drag_and_drop, _| {
drag_and_drop.register_container(weak_self.clone());
});
let mut this = Workspace {
modal: None,