mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Adopt Rect::contains in compositor hit-testing
This does make hit-testing inclusive in the right/bottom edges, whereas it was only inclusive in the top/left edges before.
This commit is contained in:
parent
797663c43e
commit
91c7acd4c4
1 changed files with 6 additions and 8 deletions
|
@ -230,12 +230,11 @@ impl CompositorData {
|
||||||
}
|
}
|
||||||
Some(rect) => {
|
Some(rect) => {
|
||||||
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
||||||
if cursor.x >= rect.origin.x && cursor.x < rect.origin.x + rect.size.width
|
if rect.contains(&cursor) &&
|
||||||
&& cursor.y >= rect.origin.y && cursor.y < rect.origin.y + rect.size.height
|
CompositorData::handle_scroll_event(child.clone(),
|
||||||
&& CompositorData::handle_scroll_event(child.clone(),
|
delta,
|
||||||
delta,
|
cursor - rect.origin,
|
||||||
cursor - rect.origin,
|
rect.size) {
|
||||||
rect.size) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,8 +311,7 @@ impl CompositorData {
|
||||||
}
|
}
|
||||||
Some(rect) => {
|
Some(rect) => {
|
||||||
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
||||||
if cursor.x >= rect.origin.x && cursor.x < rect.origin.x + rect.size.width
|
if rect.contains(&cursor) {
|
||||||
&& cursor.y >= rect.origin.y && cursor.y < rect.origin.y + rect.size.height {
|
|
||||||
CompositorData::send_mouse_event(child.clone(), event, cursor - rect.origin);
|
CompositorData::send_mouse_event(child.clone(), event, cursor - rect.origin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue