mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
LibGUI: Implement calculated_min_size() for DialogButton
Dialog buttons now scale based on presentation size to accomodate larger fonts while retaining uniform widths. Scaling by 8 is arbitrary but preserves the historical 80 pixel width with Katica 10. This needs improvement but works well for most fonts as a start.
This commit is contained in:
parent
5181fafce6
commit
479e67212a
2 changed files with 14 additions and 1 deletions
|
@ -291,4 +291,14 @@ Optional<UISize> Button::calculated_min_size() const
|
|||
return UISize(width, height);
|
||||
}
|
||||
|
||||
Optional<UISize> DialogButton::calculated_min_size() const
|
||||
{
|
||||
int constexpr scale = 8;
|
||||
int constexpr padding = 6;
|
||||
int width = max(80, font().presentation_size() * scale);
|
||||
int height = max(22, font().pixel_size_rounded_up() + padding);
|
||||
|
||||
return UISize(width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue