summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Button.xml2
-rw-r--r--scene/gui/button.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml
index adf826c26b..6a8cdcd2a8 100644
--- a/doc/classes/Button.xml
+++ b/doc/classes/Button.xml
@@ -15,7 +15,7 @@
Text alignment policy for the button's text, use one of the [code]ALIGN_*[/code] constants.
</member>
<member name="clip_text" type="bool" setter="set_clip_text" getter="get_clip_text" default="false">
- When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text. This property is disabled by default.
+ When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text.
</member>
<member name="flat" type="bool" setter="set_flat" getter="is_flat" default="false">
Flat buttons don't display decoration.
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: {