From da5195fc927614aa9340bb1a1729428f0e5bbfbc Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Wed, 28 Aug 2019 23:12:22 -0300 Subject: Fix wrong offset in Button when alignment is set to left --- scene/gui/button.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scene/gui/button.cpp') 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: { -- cgit v1.2.3