mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibDraw: Add a way to check for horizontal/vertical Rect intersections
This commit is contained in:
parent
2d39bce3f6
commit
b909d991f1
Notes:
sideshowbarker
2024-07-19 10:52:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b909d991f1c
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…
Reference in a new issue