Enable dragging from project panel to panes
Rework gpui2 drag API so that receivers need not specify the dragged view type. co-authored-by: Max <max@zed.dev> co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
c6e44683e6
commit
8791f7cefc
9 changed files with 190 additions and 100 deletions
|
@ -806,7 +806,7 @@ impl<'a> WindowContext<'a> {
|
|||
/// a specific need to register a global listener.
|
||||
pub fn on_mouse_event<Event: 'static>(
|
||||
&mut self,
|
||||
handler: impl Fn(&Event, DispatchPhase, &mut WindowContext) + 'static,
|
||||
mut handler: impl FnMut(&Event, DispatchPhase, &mut WindowContext) + 'static,
|
||||
) {
|
||||
let order = self.window.next_frame.z_index_stack.clone();
|
||||
self.window
|
||||
|
@ -1379,6 +1379,7 @@ impl<'a> WindowContext<'a> {
|
|||
self.window.mouse_position = position;
|
||||
if self.active_drag.is_none() {
|
||||
self.active_drag = Some(AnyDrag {
|
||||
value: Box::new(files.clone()),
|
||||
view: self.build_view(|_| files).into(),
|
||||
cursor_offset: position,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue