diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 55ca5fc3ee4..4e738216de2 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -487,6 +487,8 @@ Size2 Button::_fit_icon_size(const Size2 &p_size) const { } Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref p_icon) const { + // Do not include `_internal_margin`, it's already added in the `get_minimum_size` overrides. + Ref paragraph; if (p_text.is_empty()) { paragraph = text_buf; @@ -500,21 +502,6 @@ Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref 0.0f) { - left_internal_margin_with_h_separation += theme_cache.h_separation; - } - - if (_internal_margin[SIDE_RIGHT] > 0.0f) { - right_internal_margin_with_h_separation += theme_cache.h_separation; - } - - minsize.width += left_internal_margin_with_h_separation + right_internal_margin_with_h_separation; // The size after the internal element is stripped. - } - if (!expand_icon && p_icon.is_valid()) { Size2 icon_size = _fit_icon_size(p_icon->get_size()); if (vertical_icon_alignment == VERTICAL_ALIGNMENT_CENTER) {