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
This commit is contained in:
Emil Ernerfeldt 2022-11-08 11:04:54 +01:00 committed by GitHub
parent 35213606c4
commit 51ff32797d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -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(

View file

@ -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);