Fix rare issue of accidentally hovering two things at once
Closes https://github.com/emilk/egui/issues/140
This commit is contained in:
parent
ba08a919ba
commit
b8a4c9c8ce
1 changed files with 6 additions and 1 deletions
|
@ -227,7 +227,12 @@ impl CtxRef {
|
||||||
rect: Rect,
|
rect: Rect,
|
||||||
sense: Sense,
|
sense: Sense,
|
||||||
) -> Response {
|
) -> Response {
|
||||||
let interact_rect = rect.expand2((0.5 * item_spacing).min(Vec2::splat(5.0))); // make it easier to click
|
let gap = 0.5; // Just to make sure we don't accidentally hover two things at once (a small eps should be sufficient).
|
||||||
|
let interact_rect = rect.expand2(
|
||||||
|
(0.5 * item_spacing - Vec2::splat(gap))
|
||||||
|
.at_least(Vec2::splat(0.0))
|
||||||
|
.at_most(Vec2::splat(5.0)),
|
||||||
|
); // make it easier to click
|
||||||
let hovered = self.rect_contains_pointer(layer_id, clip_rect.intersect(interact_rect));
|
let hovered = self.rect_contains_pointer(layer_id, clip_rect.intersect(interact_rect));
|
||||||
self.interact_with_hovered(layer_id, id, rect, sense, hovered)
|
self.interact_with_hovered(layer_id, id, rect, sense, hovered)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue