mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibDraw: Add a way to check for horizontal/vertical Rect intersections
This commit is contained in:
parent
2d39bce3f6
commit
b909d991f1
1 changed files with 12 additions and 0 deletions
|
@ -200,6 +200,18 @@ public:
|
|||
move_by(0, delta);
|
||||
}
|
||||
|
||||
bool intersects_vertically(const Rect& other) const
|
||||
{
|
||||
return top() <= other.bottom()
|
||||
&& other.top() <= bottom();
|
||||
}
|
||||
|
||||
bool intersects_horizontally(const Rect& other) const
|
||||
{
|
||||
return left() <= other.right()
|
||||
&& other.left() <= right();
|
||||
}
|
||||
|
||||
bool intersects(const Rect& other) const
|
||||
{
|
||||
return left() <= other.right()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue