diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-29 08:33:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29 08:33:13 +0200 |
commit | dc3f8c49df5e6610b91df9e9fc043e58eb757edb (patch) | |
tree | a0ccca92b6c111bc9ae7b1cd0e747b1bcf362661 /scene/gui/button.cpp | |
parent | 65d1b0b427cdccc5b2463cbc703b922d95075895 (diff) | |
parent | da5195fc927614aa9340bb1a1729428f0e5bbfbc (diff) |
Merge pull request #31752 from YeldhamDev/button_left_offset_fix
Fix wrong offset in Button when alignment is set to left
Diffstat (limited to 'scene/gui/button.cpp')
-rw-r--r-- | scene/gui/button.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 65e9cccd05..4ce3f18505 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -159,7 +159,11 @@ void Button::_notification(int p_what) { switch (align) { case ALIGN_LEFT: { - text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x + _internal_margin[MARGIN_LEFT] + get_constant("hseparation"); + if (_internal_margin[MARGIN_LEFT] > 0) { + text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x + _internal_margin[MARGIN_LEFT] + get_constant("hseparation"); + } else { + text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x; + } text_ofs.y += style->get_offset().y; } break; case ALIGN_CENTER: { |