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:
committed by
Max Brunsfeld
co-authored by
Max
Conrad
parent
c6e44683e6
commit
8791f7cefc
@@ -1139,8 +1139,10 @@ impl AppContext {
|
||||
self.active_drag.is_some()
|
||||
}
|
||||
|
||||
pub fn active_drag(&self) -> Option<AnyView> {
|
||||
self.active_drag.as_ref().map(|drag| drag.view.clone())
|
||||
pub fn active_drag<T: 'static>(&self) -> Option<&T> {
|
||||
self.active_drag
|
||||
.as_ref()
|
||||
.and_then(|drag| drag.value.downcast_ref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,6 +1298,7 @@ impl<G: 'static> DerefMut for GlobalLease<G> {
|
||||
/// within the window or by dragging into the app from the underlying platform.
|
||||
pub struct AnyDrag {
|
||||
pub view: AnyView,
|
||||
pub value: Box<dyn Any>,
|
||||
pub cursor_offset: Point<Pixels>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user