diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-04 11:31:56 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-04 11:31:56 +0200 |
commit | bf8be34e91486cf59bab87c37fdb7ba1af02f601 (patch) | |
tree | 522977267ffe121fcd6490b6e27368202b7a57a9 | |
parent | 643da5dfad6158a1c63cae14fb2ecf7769337df8 (diff) | |
parent | 41df3caad38bebaf4e449d72933ec0681c1ac09a (diff) | |
download | redot-engine-bf8be34e91486cf59bab87c37fdb7ba1af02f601.tar.gz |
Merge pull request #93708 from bruvzg/fix_btn_ms
[Button] Use `align_to_largest_stylebox` for min. size calculation.
-rw-r--r-- | doc/classes/Button.xml | 2 | ||||
-rw-r--r-- | scene/gui/button.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index 98f25ed573..68fb918904 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -119,7 +119,7 @@ Icon modulate [Color] used when the [Button] is being pressed. </theme_item> <theme_item name="align_to_largest_stylebox" data_type="constant" type="int" default="0"> - This constant acts as a boolean. If [code]true[/code], text and icon are always aligned to the largest stylebox margins, otherwise it's aligned to the current button state stylebox margins. + This constant acts as a boolean. If [code]true[/code], the minimum size of the button and text/icon alignment is always based on the largest stylebox margins, otherwise it's based on the current button state stylebox margins. </theme_item> <theme_item name="h_separation" data_type="constant" type="int" default="4"> The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used. diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 4e738216de..dd344121e1 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -530,7 +530,7 @@ Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref<Textu } } - return _get_largest_stylebox_size() + minsize; + return (theme_cache.align_to_largest_stylebox ? _get_largest_stylebox_size() : _get_current_stylebox()->get_minimum_size()) + minsize; } void Button::_shape(Ref<TextParagraph> p_paragraph, String p_text) { |