Fix panel drag leaking through overlay (#10035)
Closes #10017. While reworking the `overlay` element in #9911, I did not realize that all overlay elements called `defer_draw` with a priority of `1`. /cc @as-cii Not including release notes, since it was only present in nightly. Release Notes: - N/A
This commit is contained in:
parent
5602593089
commit
c126fdb616
9 changed files with 33 additions and 16 deletions
|
@ -2773,6 +2773,7 @@ impl Render for CollabPanel {
|
||||||
.anchor(gpui::AnchorCorner::TopLeft)
|
.anchor(gpui::AnchorCorner::TopLeft)
|
||||||
.child(menu.clone()),
|
.child(menu.clone()),
|
||||||
)
|
)
|
||||||
|
.with_priority(1)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,11 +408,14 @@ impl PickerDelegate for ChannelModalDelegate {
|
||||||
.when(is_me, |el| el.child(Label::new("You").color(Color::Muted)))
|
.when(is_me, |el| el.child(Label::new("You").color(Color::Muted)))
|
||||||
.children(
|
.children(
|
||||||
if let (Some((menu, _)), true) = (&self.context_menu, selected) {
|
if let (Some((menu, _)), true) = (&self.context_menu, selected) {
|
||||||
Some(deferred(
|
Some(
|
||||||
anchored()
|
deferred(
|
||||||
.anchor(gpui::AnchorCorner::TopRight)
|
anchored()
|
||||||
.child(menu.clone()),
|
.anchor(gpui::AnchorCorner::TopRight)
|
||||||
))
|
.child(menu.clone()),
|
||||||
|
)
|
||||||
|
.with_priority(1),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
|
|
@ -1812,6 +1812,7 @@ impl EditorElement {
|
||||||
.anchor(AnchorCorner::TopLeft)
|
.anchor(AnchorCorner::TopLeft)
|
||||||
.snap_to_window(),
|
.snap_to_window(),
|
||||||
)
|
)
|
||||||
|
.with_priority(1)
|
||||||
.into_any();
|
.into_any();
|
||||||
|
|
||||||
element.layout(gpui::Point::default(), AvailableSpace::min_size(), cx);
|
element.layout(gpui::Point::default(), AvailableSpace::min_size(), cx);
|
||||||
|
|
|
@ -15,6 +15,16 @@ pub struct Deferred {
|
||||||
priority: usize,
|
priority: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Deferred {
|
||||||
|
/// Sets the `priority` value of the `deferred` element, which
|
||||||
|
/// determines the drawing order relative to other deferred elements,
|
||||||
|
/// with higher values being drawn on top.
|
||||||
|
pub fn with_priority(mut self, priority: usize) -> Self {
|
||||||
|
self.priority = priority;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Element for Deferred {
|
impl Element for Deferred {
|
||||||
type BeforeLayout = ();
|
type BeforeLayout = ();
|
||||||
type AfterLayout = ();
|
type AfterLayout = ();
|
||||||
|
|
|
@ -1590,6 +1590,7 @@ impl Render for ProjectPanel {
|
||||||
.anchor(gpui::AnchorCorner::TopLeft)
|
.anchor(gpui::AnchorCorner::TopLeft)
|
||||||
.child(menu.clone()),
|
.child(menu.clone()),
|
||||||
)
|
)
|
||||||
|
.with_priority(1)
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
v_flex()
|
v_flex()
|
||||||
|
|
|
@ -771,6 +771,7 @@ impl Render for TerminalView {
|
||||||
.anchor(gpui::AnchorCorner::TopLeft)
|
.anchor(gpui::AnchorCorner::TopLeft)
|
||||||
.child(menu.clone()),
|
.child(menu.clone()),
|
||||||
)
|
)
|
||||||
|
.with_priority(1)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,8 +182,9 @@ impl<M: ManagedView> Element for PopoverMenu<M> {
|
||||||
this.resolved_attach().corner(child_bounds) + this.resolved_offset(cx),
|
this.resolved_attach().corner(child_bounds) + this.resolved_offset(cx),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let mut element =
|
let mut element = deferred(anchored.child(div().occlude().child(menu.clone())))
|
||||||
deferred(anchored.child(div().occlude().child(menu.clone()))).into_any();
|
.with_priority(1)
|
||||||
|
.into_any();
|
||||||
|
|
||||||
menu_layout_id = Some(element.before_layout(cx));
|
menu_layout_id = Some(element.before_layout(cx));
|
||||||
element
|
element
|
||||||
|
|
|
@ -110,8 +110,9 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
||||||
}
|
}
|
||||||
anchored = anchored.position(*element_state.position.borrow());
|
anchored = anchored.position(*element_state.position.borrow());
|
||||||
|
|
||||||
let mut element =
|
let mut element = deferred(anchored.child(div().occlude().child(menu.clone())))
|
||||||
deferred(anchored.child(div().occlude().child(menu.clone()))).into_any();
|
.with_priority(1)
|
||||||
|
.into_any();
|
||||||
|
|
||||||
menu_layout_id = Some(element.before_layout(cx));
|
menu_layout_id = Some(element.before_layout(cx));
|
||||||
element
|
element
|
||||||
|
|
|
@ -1562,16 +1562,14 @@ impl Pane {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_menu_overlay(menu: &View<ContextMenu>) -> Div {
|
fn render_menu_overlay(menu: &View<ContextMenu>) -> Div {
|
||||||
div()
|
div().absolute().bottom_0().right_0().size_0().child(
|
||||||
.absolute()
|
deferred(
|
||||||
.bottom_0()
|
|
||||||
.right_0()
|
|
||||||
.size_0()
|
|
||||||
.child(deferred(
|
|
||||||
anchored()
|
anchored()
|
||||||
.anchor(AnchorCorner::TopRight)
|
.anchor(AnchorCorner::TopRight)
|
||||||
.child(menu.clone()),
|
.child(menu.clone()),
|
||||||
))
|
)
|
||||||
|
.with_priority(1),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_zoomed(&mut self, zoomed: bool, cx: &mut ViewContext<Self>) {
|
pub fn set_zoomed(&mut self, zoomed: bool, cx: &mut ViewContext<Self>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue