Rename Drawable::boxed to into_element and make containers generic
Multi-element are now generic over any drawable child, which can be converted into an element. Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
4d433663bd
commit
03619dfa55
80 changed files with 1132 additions and 1434 deletions
|
@ -5,8 +5,7 @@ use gpui::{
|
|||
geometry::{rect::RectF, vector::Vector2F},
|
||||
platform::MouseButton,
|
||||
scene::MouseUp,
|
||||
AppContext, Drawable, Element, EventContext, MouseState, Quad, View, ViewContext,
|
||||
WeakViewHandle,
|
||||
AppContext, Drawable, EventContext, MouseState, Quad, View, ViewContext, WeakViewHandle,
|
||||
};
|
||||
use project::ProjectEntryId;
|
||||
use settings::Settings;
|
||||
|
@ -18,7 +17,7 @@ use crate::{
|
|||
|
||||
use super::DraggedItem;
|
||||
|
||||
pub fn dragged_item_receiver<Tag, F>(
|
||||
pub fn dragged_item_receiver<Tag, D, F>(
|
||||
region_id: usize,
|
||||
drop_index: usize,
|
||||
allow_same_pane: bool,
|
||||
|
@ -28,7 +27,8 @@ pub fn dragged_item_receiver<Tag, F>(
|
|||
) -> MouseEventHandler<Tag, Pane>
|
||||
where
|
||||
Tag: 'static,
|
||||
F: FnOnce(&mut MouseState, &mut ViewContext<Pane>) -> Element<Pane>,
|
||||
D: Drawable<Pane>,
|
||||
F: FnOnce(&mut MouseState, &mut ViewContext<Pane>) -> D,
|
||||
{
|
||||
MouseEventHandler::<Tag, _>::above(region_id, cx, |state, cx| {
|
||||
// Observing hovered will cause a render when the mouse enters regardless
|
||||
|
@ -69,9 +69,7 @@ where
|
|||
});
|
||||
}
|
||||
})
|
||||
.boxed()
|
||||
}))
|
||||
.boxed()
|
||||
})
|
||||
.on_up(MouseButton::Left, {
|
||||
move |event, _, cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue