mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibGUI: Bias text towards bottom when tabs at top have uneven spacing
This makes the text on inactive tabs in Browser look a lil' bit nicer. :^)
This commit is contained in:
parent
4959fa4f1e
commit
a086be993b
Notes:
sideshowbarker
2024-07-18 05:01:54 +09:00
Author: https://github.com/sin-ack
Commit: a086be993b
Pull-request: https://github.com/SerenityOS/serenity/pull/9698
1 changed files with 7 additions and 0 deletions
|
@ -218,6 +218,13 @@ void TabWidget::paint_event(PaintEvent& event)
|
|||
auto icon_rect_difference = icon_rect.top() - text_rect.top();
|
||||
text_rect.set_top(text_rect.top() + icon_rect_difference);
|
||||
text_rect.set_height(text_rect.height() - icon_rect_difference);
|
||||
|
||||
// ...unless our leftover height after text drawing is uneven, in which
|
||||
// case we want to bias towards the bottom when the tab position is at
|
||||
// the top.
|
||||
if ((text_rect.height() - font().glyph_height()) % 2 != 0 && m_tab_position == TabPosition::Top) {
|
||||
text_rect.set_top(text_rect.top() + 1);
|
||||
}
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < m_tabs.size(); ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue