diff options
author | Hendrik Brucker <hendrik.brucker@mail.de> | 2022-05-10 22:27:48 +0200 |
---|---|---|
committer | Hendrik Brucker <hendrik.brucker@mail.de> | 2022-05-10 22:27:48 +0200 |
commit | c09a5e277410761733a59a2b207d7320131b2511 (patch) | |
tree | 8f64d2afd0617c8c23b400dc0a721f650f0ecb78 /scene | |
parent | ff071377d40cf2970cebbde8ad082da79bd28331 (diff) |
Fix button icon expansion calculation with empty text
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/button.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index b7c1e674dd..ff194f979d 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -258,7 +258,8 @@ void Button::_notification(int p_what) { if (expand_icon) { Size2 _size = get_size() - style->get_offset() * 2; - _size.width -= get_theme_constant(SNAME("h_separation")) + icon_ofs_region; + int icon_text_separation = text.is_empty() ? 0 : get_theme_constant(SNAME("h_separation")); + _size.width -= icon_text_separation + icon_ofs_region; if (!clip_text && icon_align_rtl_checked != HORIZONTAL_ALIGNMENT_CENTER) { _size.width -= text_buf->get_size().width; } |