summaryrefslogtreecommitdiffstats
path: root/scene/gui/button.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-05-10 22:58:56 +0200
committerGitHub <noreply@github.com>2022-05-10 22:58:56 +0200
commit694baff233c2efb4675f708389c9ff2bbc00bc03 (patch)
treea4709ae3dc8e4ecda338882f28cc9f4e0b9a41af /scene/gui/button.cpp
parent917fd65748957304c987414c63d54ef4f6972394 (diff)
parentc09a5e277410761733a59a2b207d7320131b2511 (diff)
downloadredot-engine-694baff233c2efb4675f708389c9ff2bbc00bc03.tar.gz
Merge pull request #60932 from Geometror/button-fix-expand-icon
Diffstat (limited to 'scene/gui/button.cpp')
-rw-r--r--scene/gui/button.cpp3
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;
}