diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-31 11:25:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 11:25:13 +0100 |
commit | 5da20d6cf2b334a0703f95fd05e84a9a5aa29a0f (patch) | |
tree | 6c485d0d979397d07e07069a1b2237e992b258a8 | |
parent | ab2f91bdfb6595627633af319cb63240d3cd0426 (diff) | |
parent | ddc397d9ff81294b73609e9e834a2c11bfe4b99e (diff) |
Merge pull request #35612 from timothyqiu/option-button-arrow
Fixes OptionButton minimum size
-rw-r--r-- | scene/gui/option_button.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 8598a953b4..3f46afa8e8 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -36,7 +36,14 @@ Size2 OptionButton::get_minimum_size() const { Size2 minsize = Button::get_minimum_size(); if (has_icon("arrow")) { - minsize.width += Control::get_icon("arrow")->get_width() + get_constant("hseparation"); + const Size2 padding = get_stylebox("normal")->get_minimum_size(); + const Size2 arrow_size = Control::get_icon("arrow")->get_size(); + + Size2 content_size = minsize - padding; + content_size.width += arrow_size.width + get_constant("hseparation"); + content_size.height = MAX(content_size.height, arrow_size.height); + + minsize = content_size + padding; } return minsize; |