LibDraw: Add a way to check for horizontal/vertical Rect intersections

This commit is contained in:
Andreas Kling 2019-12-13 23:35:44 +01:00
parent 2d39bce3f6
commit b909d991f1
Notes: sideshowbarker 2024-07-19 10:52:22 +09:00

View file

@ -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()