mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Rect: Add set_right_without_resize() and set_bottom_without_resize()
Sometimes you want to move the Rect by its right or bottom edge without resizing the rect in the process. There are probably better names for this but nothing comes to mind at the moment.
This commit is contained in:
parent
3596522d23
commit
fcf5b1ff5b
1 changed files with 12 additions and 0 deletions
|
@ -192,6 +192,18 @@ public:
|
|||
set_height(bottom - y() + 1);
|
||||
}
|
||||
|
||||
void set_right_without_resize(int new_right)
|
||||
{
|
||||
int delta = new_right - right();
|
||||
move_by(delta, 0);
|
||||
}
|
||||
|
||||
void set_bottom_without_resize(int new_bottom)
|
||||
{
|
||||
int delta = new_bottom - bottom();
|
||||
move_by(0, delta);
|
||||
}
|
||||
|
||||
bool intersects(const Rect& other) const
|
||||
{
|
||||
return left() <= other.right()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue