Skip to content

Commit

Permalink
Fixes OptionButton min size
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyqiu committed Jan 27, 2020
1 parent 5db45fb commit ddc397d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scene/gui/option_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ddc397d

Please sign in to comment.