mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Replaced rect_contains_point with Rect.contains()
This commit is contained in:
parent
8ae008761f
commit
96a8b442b8
2 changed files with 4 additions and 14 deletions
|
@ -86,16 +86,6 @@ pub static MAX_RECT: Rect<Au> = Rect {
|
|||
}
|
||||
};
|
||||
|
||||
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
|
||||
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
|
||||
/// not considered inside the rectangle.
|
||||
pub fn rect_contains_point<T>(rect: Rect<T>, point: Point2D<T>) -> bool
|
||||
where T: PartialOrd + Add<T, Output=T>
|
||||
{
|
||||
point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
|
||||
point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
|
||||
}
|
||||
|
||||
/// A helper function to convert a rect of `f32` pixels to a rect of app units.
|
||||
pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> {
|
||||
Rect::new(Point2D::new(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue