Fix panel button context menu overlap with tooltip hint (#30108)
This fix works by disabling the tooltip whenever the menu is being rendered. ### Before  ### After  Release Notes: - Fix panel button tooltip overlapping with the panel button's right click menu
This commit is contained in:
parent
02765947e0
commit
7bc3f74cab
@ -21,8 +21,14 @@ impl<M: ManagedView> RightClickMenu<M> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn trigger<E: IntoElement + 'static>(mut self, e: E) -> Self {
|
||||
self.child_builder = Some(Box::new(move |_| e.into_any_element()));
|
||||
pub fn trigger<F, E>(mut self, e: F) -> Self
|
||||
where
|
||||
F: FnOnce(bool) -> E + 'static,
|
||||
E: IntoElement + 'static,
|
||||
{
|
||||
self.child_builder = Some(Box::new(move |is_menu_active| {
|
||||
e(is_menu_active).into_any_element()
|
||||
}));
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,12 @@ impl Render for ContextMenuStory {
|
||||
.justify_between()
|
||||
.child(
|
||||
right_click_menu("test2")
|
||||
.trigger(Label::new("TOP LEFT"))
|
||||
.trigger(|_| Label::new("TOP LEFT"))
|
||||
.menu(move |window, cx| build_menu(window, cx, "top left")),
|
||||
)
|
||||
.child(
|
||||
right_click_menu("test1")
|
||||
.trigger(Label::new("BOTTOM LEFT"))
|
||||
.trigger(|_| Label::new("BOTTOM LEFT"))
|
||||
.anchor(Corner::BottomLeft)
|
||||
.attach(Corner::TopLeft)
|
||||
.menu(move |window, cx| build_menu(window, cx, "bottom left")),
|
||||
@ -65,13 +65,13 @@ impl Render for ContextMenuStory {
|
||||
.justify_between()
|
||||
.child(
|
||||
right_click_menu("test3")
|
||||
.trigger(Label::new("TOP RIGHT"))
|
||||
.trigger(|_| Label::new("TOP RIGHT"))
|
||||
.anchor(Corner::TopRight)
|
||||
.menu(move |window, cx| build_menu(window, cx, "top right")),
|
||||
)
|
||||
.child(
|
||||
right_click_menu("test4")
|
||||
.trigger(Label::new("BOTTOM RIGHT"))
|
||||
.trigger(|_| Label::new("BOTTOM RIGHT"))
|
||||
.anchor(Corner::BottomRight)
|
||||
.attach(Corner::TopRight)
|
||||
.menu(move |window, cx| build_menu(window, cx, "bottom right")),
|
||||
|
@ -889,7 +889,7 @@ impl Render for PanelButtons {
|
||||
})
|
||||
.anchor(menu_anchor)
|
||||
.attach(menu_attach)
|
||||
.trigger(
|
||||
.trigger(move |is_active| {
|
||||
IconButton::new(name, icon)
|
||||
.icon_size(IconSize::Small)
|
||||
.toggle_state(is_active_button)
|
||||
@ -899,10 +899,12 @@ impl Render for PanelButtons {
|
||||
window.dispatch_action(action.boxed_clone(), cx)
|
||||
}
|
||||
})
|
||||
.tooltip(move |window, cx| {
|
||||
.when(!is_active, |this| {
|
||||
this.tooltip(move |window, cx| {
|
||||
Tooltip::for_action(tooltip.clone(), &*action, window, cx)
|
||||
})
|
||||
})
|
||||
}),
|
||||
),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
@ -2374,7 +2374,9 @@ impl Pane {
|
||||
let is_pinned = self.is_tab_pinned(ix);
|
||||
let pane = cx.entity().downgrade();
|
||||
let menu_context = item.item_focus_handle(cx);
|
||||
right_click_menu(ix).trigger(tab).menu(move |window, cx| {
|
||||
right_click_menu(ix)
|
||||
.trigger(|_| tab)
|
||||
.menu(move |window, cx| {
|
||||
let pane = pane.clone();
|
||||
let menu_context = menu_context.clone();
|
||||
ContextMenu::build(window, cx, move |mut menu, window, cx| {
|
||||
|
Loading…
Reference in New Issue
Block a user