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

LibGfx: Make Rect::align_within() correct for TopCenter and BottomCenter

Also update the LibGfxDemo to actually show off these alignments.
This commit is contained in:
Andreas Kling 2023-01-09 18:51:22 +01:00
parent f63ecc2763
commit c55739bbc0
2 changed files with 5 additions and 2 deletions

View file

@ -139,9 +139,11 @@ void Canvas::draw()
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "Center"sv, Gfx::TextAlignment::Center, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "CenterRight"sv, Gfx::TextAlignment::CenterRight, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "TopLeft"sv, Gfx::TextAlignment::TopLeft, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "TopCenter"sv, Gfx::TextAlignment::TopCenter, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "TopRight"sv, Gfx::TextAlignment::TopRight, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "BottomLeft"sv, Gfx::TextAlignment::BottomLeft, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "BottomRight"sv, Gfx::TextAlignment::BottomRight, Color::White);
painter.draw_text(Gfx::IntRect { 520, 260, 240, 80 }, "BottomCenter"sv, Gfx::TextAlignment::BottomCenter, Color::White);
painter.draw_rect({ 520, 360, 240, 30 }, Color::DarkGray);
painter.draw_text(Gfx::IntRect { 520, 360, 240, 30 }, "Emojis! 🙂😂🐞🦄"sv, Gfx::TextAlignment::Center, Color::White);