Skip to content

Commit

Permalink
Make normal buttons have extra margin
Browse files Browse the repository at this point in the history
when they have multi-lined  button text
  • Loading branch information
zenseii committed Jan 13, 2025
1 parent 744f9fc commit 2b5c1b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fheroes2/gui/ui_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,10 @@ namespace fheroes2
const int32_t textHeight = releasedText.height( textAreaWidth );
assert( textHeight > 0 );

// Add extra y margin for multilined texts on normal buttons
if ( ( emptyButtonIcnID == ICN::EMPTY_EVIL_BUTTON || emptyButtonIcnID == ICN::EMPTY_GOOD_BUTTON ) && textHeight > 17 ) {
textAreaMargins.y += 16;
}
const int32_t borderedTextHeight = textHeight + textAreaMargins.y;
const int32_t textAreaHeight = std::clamp( borderedTextHeight, minimumTextArea.height, maximumTextArea.height );

Expand Down

0 comments on commit 2b5c1b9

Please sign in to comment.