From 51ff32797da027125e9ce2b9903251b61d1bb11b Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 8 Nov 2022 11:04:54 +0100 Subject: [PATCH] Give each tooltip area its own unique `Id` (#2264) * Don't check for clicks on non-interactive areas * Give each tooltip area its own unique Id --- crates/egui/src/containers/area.rs | 4 +++- crates/egui/src/containers/popup.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/containers/area.rs b/crates/egui/src/containers/area.rs index f302c65f..17ecea5b 100644 --- a/crates/egui/src/containers/area.rs +++ b/crates/egui/src/containers/area.rs @@ -236,8 +236,10 @@ impl Area { let interact_id = layer_id.id.with("move"); let sense = if movable { Sense::click_and_drag() - } else { + } else if interactable { Sense::click() // allow clicks to bring to front + } else { + Sense::hover() }; let move_response = ctx.interact( diff --git a/crates/egui/src/containers/popup.rs b/crates/egui/src/containers/popup.rs index f18919bb..9742ac43 100644 --- a/crates/egui/src/containers/popup.rs +++ b/crates/egui/src/containers/popup.rs @@ -209,7 +209,8 @@ fn show_tooltip_at_avoid_dyn<'c, R>( let position = position.at_least(ctx.input().screen_rect().min); - let InnerResponse { inner, response } = show_tooltip_area_dyn(ctx, id, position, add_contents); + let InnerResponse { inner, response } = + show_tooltip_area_dyn(ctx, id.with(count), position, add_contents); state.set_tooltip_size(id, count, response.rect.size()); state.store(ctx);