mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibCards: Fix alignment for the card labels
Previously the code didn't take into account that the label for the "10" card is larger than for the other cards.
This commit is contained in:
parent
ee48dac300
commit
661a8707f0
Notes:
sideshowbarker
2024-07-18 17:33:39 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/661a8707f04 Pull-request: https://github.com/SerenityOS/serenity/pull/7384
1 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,8 @@ Card::Card(Type type, uint8_t value)
|
|||
paint_rect.set_height(paint_rect.height() / 2);
|
||||
paint_rect.shrink(10, 6);
|
||||
|
||||
painter.draw_text(paint_rect, label, font, Gfx::TextAlignment::TopLeft, color());
|
||||
auto text_rect = Gfx::IntRect { 4, 6, font.width("10"), font.glyph_height() };
|
||||
painter.draw_text(text_rect, label, font, Gfx::TextAlignment::Center, color());
|
||||
|
||||
NonnullRefPtr<Gfx::CharacterBitmap> symbol = s_diamond;
|
||||
switch (m_type) {
|
||||
|
@ -117,7 +118,7 @@ Card::Card(Type type, uint8_t value)
|
|||
}
|
||||
|
||||
painter.draw_bitmap(
|
||||
{ paint_rect.x() + (font.width(label) - symbol->size().width()) / 2, font.glyph_height() + paint_rect.y() + 3 },
|
||||
{ text_rect.x() + (text_rect.width() - symbol->size().width()) / 2, text_rect.bottom() + 5 },
|
||||
symbol, color());
|
||||
|
||||
for (int y = height / 2; y < height; ++y) {
|
||||
|
|
Loading…
Reference in a new issue