Handle tab drag end on pane items to insert after active item
Co-Authored-By: Kay Simmons <kay@zed.dev>
This commit is contained in:
committed by
K Simmons
co-authored by
Kay Simmons
parent
c295f943ba
commit
b9f9819637
@@ -172,26 +172,28 @@ impl<Tag> Element for MouseEventHandler<Tag> {
|
||||
) -> Self::PaintState {
|
||||
let visible_bounds = visible_bounds.intersection(bounds).unwrap_or_default();
|
||||
let hit_bounds = self.hit_bounds(visible_bounds);
|
||||
if let Some(style) = self.cursor_style {
|
||||
cx.scene.push_cursor_region(CursorRegion {
|
||||
bounds: hit_bounds,
|
||||
style,
|
||||
});
|
||||
}
|
||||
|
||||
cx.scene.push_mouse_region(
|
||||
MouseRegion::from_handlers::<Tag>(
|
||||
cx.current_view_id(),
|
||||
self.region_id,
|
||||
hit_bounds,
|
||||
self.handlers.clone(),
|
||||
)
|
||||
.with_hoverable(self.hoverable)
|
||||
.with_notify_on_hover(self.notify_on_hover)
|
||||
.with_notify_on_click(self.notify_on_click),
|
||||
);
|
||||
|
||||
self.child.paint(bounds.origin(), visible_bounds, cx);
|
||||
|
||||
cx.paint_stacking_context(None, |cx| {
|
||||
if let Some(style) = self.cursor_style {
|
||||
cx.scene.push_cursor_region(CursorRegion {
|
||||
bounds: hit_bounds,
|
||||
style,
|
||||
});
|
||||
}
|
||||
cx.scene.push_mouse_region(
|
||||
MouseRegion::from_handlers::<Tag>(
|
||||
cx.current_view_id(),
|
||||
self.region_id,
|
||||
hit_bounds,
|
||||
self.handlers.clone(),
|
||||
)
|
||||
.with_hoverable(self.hoverable)
|
||||
.with_notify_on_hover(self.notify_on_hover)
|
||||
.with_notify_on_click(self.notify_on_click),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
fn rect_for_text_range(
|
||||
|
||||
@@ -42,9 +42,9 @@ impl Element for Stack {
|
||||
cx: &mut PaintContext,
|
||||
) -> Self::PaintState {
|
||||
for child in &mut self.children {
|
||||
cx.scene.push_layer(None);
|
||||
child.paint(bounds.origin(), visible_bounds, cx);
|
||||
cx.scene.pop_layer();
|
||||
cx.paint_layer(None, |cx| {
|
||||
child.paint(bounds.origin(), visible_bounds, cx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -707,6 +707,16 @@ impl<'a> PaintContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn paint_stacking_context<F>(&mut self, clip_bounds: Option<RectF>, f: F)
|
||||
where
|
||||
F: FnOnce(&mut Self),
|
||||
{
|
||||
self.scene.push_stacking_context(clip_bounds);
|
||||
f(self);
|
||||
self.scene.pop_stacking_context();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn paint_layer<F>(&mut self, clip_bounds: Option<RectF>, f: F)
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user