mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibDraw: Add TextAlignment::TopRight
Also tidy up the alignment code to use switch statements.
This commit is contained in:
parent
cb62890f8e
commit
a791b86afa
3 changed files with 33 additions and 15 deletions
|
@ -86,6 +86,10 @@ void Rect::align_within(const Rect& other, TextAlignment alignment)
|
|||
case TextAlignment::TopLeft:
|
||||
set_location(other.location());
|
||||
return;
|
||||
case TextAlignment::TopRight:
|
||||
set_x(other.x() + other.width() - width());
|
||||
set_y(other.y());
|
||||
return;
|
||||
case TextAlignment::CenterLeft:
|
||||
set_x(other.x());
|
||||
center_vertically_within(other);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue