mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibGUI: Fix multi-line tooltip height
Tooltips had a wrong calculation for the height of a tooltip window, because they forgot to take into account the line spacing.
This commit is contained in:
parent
3904541938
commit
02c0b1f380
1 changed files with 3 additions and 1 deletions
|
@ -28,7 +28,9 @@ public:
|
|||
{
|
||||
m_label->set_text(Gfx::parse_ampersand_string(tooltip));
|
||||
int tooltip_width = m_label->min_width() + 10;
|
||||
int tooltip_height = m_label->font().glyph_height() * max(1, m_label->text().count("\n")) + 8;
|
||||
int line_count = m_label->text().count("\n");
|
||||
int glyph_height = m_label->font().glyph_height();
|
||||
int tooltip_height = glyph_height * (1 + line_count) + ((glyph_height + 1) / 2) * line_count + 8;
|
||||
|
||||
Gfx::IntRect desktop_rect = Desktop::the().rect();
|
||||
if (tooltip_width > desktop_rect.width())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue