1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

Rect: Add contains_vertically(y) and contains_horizontally(x)

This commit is contained in:
Andreas Kling 2019-09-01 17:28:49 +02:00
parent c686264703
commit 72a29d72d3

View file

@ -115,6 +115,16 @@ public:
return rect;
}
bool contains_vertically(int y) const
{
return y >= top() && y <= bottom();
}
bool contains_horizontally(int x) const
{
return x >= left() && x <= right();
}
bool contains(int x, int y) const
{
return x >= m_location.x() && x <= right() && y >= m_location.y() && y <= bottom();