1
Fork 0
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:
Andreas Kling 2019-09-06 19:23:36 +02:00
parent cb62890f8e
commit a791b86afa
3 changed files with 33 additions and 15 deletions

View file

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