mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Merge pull request #2781 from zwarich/compositor-contains
Adopt Rect::contains in compositor hit-testing
This commit is contained in:
commit
f8fbf557f1
2 changed files with 7 additions and 9 deletions
|
@ -230,9 +230,8 @@ impl CompositorData {
|
|||
}
|
||||
Some(rect) => {
|
||||
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
||||
if cursor.x >= rect.origin.x && cursor.x < rect.origin.x + rect.size.width
|
||||
&& cursor.y >= rect.origin.y && cursor.y < rect.origin.y + rect.size.height
|
||||
&& CompositorData::handle_scroll_event(child.clone(),
|
||||
if rect.contains(&cursor) &&
|
||||
CompositorData::handle_scroll_event(child.clone(),
|
||||
delta,
|
||||
cursor - rect.origin,
|
||||
rect.size) {
|
||||
|
@ -312,8 +311,7 @@ impl CompositorData {
|
|||
}
|
||||
Some(rect) => {
|
||||
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&rect);
|
||||
if cursor.x >= rect.origin.x && cursor.x < rect.origin.x + rect.size.width
|
||||
&& cursor.y >= rect.origin.y && cursor.y < rect.origin.y + rect.size.height {
|
||||
if rect.contains(&cursor) {
|
||||
CompositorData::send_mouse_event(child.clone(), event, cursor - rect.origin);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2b5981a97ab607a7b24f39484105d17c1e3a6fb8
|
||||
Subproject commit 862af73433f36f156519ff24bd87abd3a8c10790
|
Loading…
Add table
Add a link
Reference in a new issue