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

Fix: Response::clicked_elsewhere takes clip rect into account #4274

Merged
merged 1 commit into from
Mar 30, 2024
Merged
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
8 changes: 2 additions & 6 deletions crates/egui/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,10 @@ impl Response {
let pointer = &i.pointer;

if pointer.any_click() {
// We detect clicks/hover on a "interact_rect" that is slightly larger than
// self.rect. See Context::interact.
// This means we can be hovered and clicked even though `!self.rect.contains(pos)` is true,
// hence the extra complexity here.
if self.contains_pointer() {
if self.contains_pointer || self.hovered {
false
} else if let Some(pos) = pointer.interact_pos() {
!self.rect.contains(pos)
!self.interact_rect.contains(pos)
} else {
false // clicked without a pointer, weird
}
Expand Down
Loading