Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure tooltips are interactable #4649

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/containers/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion crates/egui/src/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion crates/egui/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Loading