Make sure tooltips are interactable (#4649)
…so you can't hover things underneath them. * Better version of https://github.com/emilk/egui/pull/4648
This commit is contained in:
parent
e2a127a381
commit
ca36f3df63
|
@ -172,7 +172,10 @@ impl Area {
|
|||
}
|
||||
|
||||
/// If false, clicks goes straight through to what is behind us.
|
||||
/// Good for tooltips etc.
|
||||
///
|
||||
/// Can be used for semi-invisible areas that the user should be able to click through.
|
||||
///
|
||||
/// Default: `true`.
|
||||
#[inline]
|
||||
pub fn interactable(mut self, interactable: bool) -> Self {
|
||||
self.interactable = interactable;
|
||||
|
|
|
@ -136,7 +136,7 @@ fn show_tooltip_at_avoid_dyn<'c, R>(
|
|||
.pivot(pivot)
|
||||
.fixed_pos(anchor)
|
||||
.default_width(ctx.style().spacing.tooltip_width)
|
||||
.interactable(false) // Only affects the actual area, i.e. clicking and dragging it. The content can still be interactive.
|
||||
.sense(Sense::hover()) // don't click to bring to front
|
||||
.show(ctx, |ui| {
|
||||
// By default the text in tooltips aren't selectable.
|
||||
// This means that most tooltips aren't interactable,
|
||||
|
|
|
@ -92,7 +92,11 @@ impl<'open> Window<'open> {
|
|||
self
|
||||
}
|
||||
|
||||
/// If `false` the window will be non-interactive.
|
||||
/// If false, clicks goes straight through to what is behind us.
|
||||
///
|
||||
/// Can be used for semi-invisible areas that the user should be able to click through.
|
||||
///
|
||||
/// Default: `true`.
|
||||
#[inline]
|
||||
pub fn interactable(mut self, interactable: bool) -> Self {
|
||||
self.area = self.area.interactable(interactable);
|
||||
|
|
|
@ -149,7 +149,6 @@ fn menu_popup<'c, R>(
|
|||
.kind(UiKind::Menu)
|
||||
.order(Order::Foreground)
|
||||
.fixed_pos(pos)
|
||||
.interactable(true)
|
||||
.default_width(ctx.style().spacing.menu_width)
|
||||
.sense(Sense::hover());
|
||||
|
||||
|
|
Loading…
Reference in New Issue