diff options
Diffstat (limited to 'scene/gui/button.cpp')
| -rw-r--r-- | scene/gui/button.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 978fb56f78..ad3f607661 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -50,10 +50,6 @@ void Button::_set_internal_margin(Side p_side, float p_value) { void Button::_queue_update_size_cache() { } -void Button::_set_h_separation_is_valid_when_no_text(bool p_h_separation_is_valid_when_no_text) { - h_separation_is_valid_when_no_text = p_h_separation_is_valid_when_no_text; -} - Ref<StyleBox> Button::_get_current_stylebox() const { Ref<StyleBox> stylebox = theme_cache.normal; const bool rtl = is_layout_rtl(); @@ -180,14 +176,12 @@ void Button::_notification(int p_what) { float right_internal_margin_with_h_separation = _internal_margin[SIDE_RIGHT]; { // The width reserved for internal element in derived classes (and h_separation if need). - if (!xl_text.is_empty() || h_separation_is_valid_when_no_text) { - if (_internal_margin[SIDE_LEFT] > 0.0f) { - left_internal_margin_with_h_separation += h_separation; - } + if (_internal_margin[SIDE_LEFT] > 0.0f) { + left_internal_margin_with_h_separation += h_separation; + } - if (_internal_margin[SIDE_RIGHT] > 0.0f) { - right_internal_margin_with_h_separation += h_separation; - } + if (_internal_margin[SIDE_RIGHT] > 0.0f) { + right_internal_margin_with_h_separation += h_separation; } drawable_size_remained.width -= left_internal_margin_with_h_separation + right_internal_margin_with_h_separation; // The size after the internal element is stripped. @@ -364,7 +358,7 @@ void Button::_notification(int p_what) { if (!xl_text.is_empty()) { text_buf->set_alignment(align_rtl_checked); - float text_buf_width = MAX(1.0f, drawable_size_remained.width); // The space's width filled by the text_buf. + float text_buf_width = Math::ceil(MAX(1.0f, drawable_size_remained.width)); // The space's width filled by the text_buf. text_buf->set_width(text_buf_width); Point2 text_ofs; |
