mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +00:00
LibGfx: Add missing TextAlignment::BottomLeft
This commit is contained in:
parent
8cbdcffd05
commit
9dd3203cc6
6 changed files with 19 additions and 5 deletions
|
@ -1229,6 +1229,7 @@ void draw_text_line(const IntRect& a_rect, const TextType& text, const Font& fon
|
|||
switch (alignment) {
|
||||
case TextAlignment::TopLeft:
|
||||
case TextAlignment::CenterLeft:
|
||||
case TextAlignment::BottomLeft:
|
||||
break;
|
||||
case TextAlignment::TopRight:
|
||||
case TextAlignment::CenterRight:
|
||||
|
@ -1501,6 +1502,9 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T
|
|||
case TextAlignment::Center:
|
||||
bounding_rect.center_within(rect);
|
||||
break;
|
||||
case TextAlignment::BottomLeft:
|
||||
bounding_rect.set_location({ rect.x(), (rect.bottom() + 1) - bounding_rect.height() });
|
||||
break;
|
||||
case TextAlignment::BottomRight:
|
||||
bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), (rect.bottom() + 1) - bounding_rect.height() });
|
||||
break;
|
||||
|
|
|
@ -114,6 +114,10 @@ void Rect<T>::align_within(const Rect<T>& other, TextAlignment alignment)
|
|||
set_x(other.x() + other.width() - width());
|
||||
center_vertically_within(other);
|
||||
return;
|
||||
case TextAlignment::BottomLeft:
|
||||
set_x(other.x());
|
||||
set_y(other.y() + other.height() - height());
|
||||
return;
|
||||
case TextAlignment::BottomRight:
|
||||
set_x(other.x() + other.width() - width());
|
||||
set_y(other.y() + other.height() - height());
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
namespace Gfx {
|
||||
|
||||
#define GFX_ENUMERATE_TEXT_ALIGNMENTS(M) \
|
||||
M(TopLeft) \
|
||||
M(CenterLeft) \
|
||||
M(Center) \
|
||||
M(CenterLeft) \
|
||||
M(CenterRight) \
|
||||
M(TopLeft) \
|
||||
M(TopRight) \
|
||||
M(BottomLeft) \
|
||||
M(BottomRight)
|
||||
|
||||
enum class TextAlignment {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue