Fix: `Response::clicked_elsewhere` takes clip rect into account (#4274)
`clicked_elsewhere` now checks against the clipped `interact_rect` of the widget instead of the full `rect`. In practice this shouldn't change much since the function is mostly used for windows and areas, which aren't clipped.
This commit is contained in:
parent
a7c5eb47a8
commit
8da0e8cc77
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue