Skip to content

Commit

Permalink
Merge pull request #26352 from bojidar-bg/21633-progress-stylebox
Browse files Browse the repository at this point in the history
Fix minimum size of ProgressBar-s
  • Loading branch information
akien-mga authored Feb 27, 2019
2 parents eb2b9b8 + a7b564d commit ce615c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions editor/plugins/animation_blend_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
}

pb->set_percent_visible(false);
pb->set_custom_minimum_size(Vector2(0, 14) * EDSCALE);
animations[E->get()] = pb;
node->add_child(pb);

Expand Down
9 changes: 6 additions & 3 deletions scene/gui/progress_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ Size2 ProgressBar::get_minimum_size() const {
Size2 minimum_size = bg->get_minimum_size();
minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
minimum_size.width = MAX(minimum_size.width, fg->get_minimum_size().width);
//if (percent_visible) { this is needed, else the progressbar will collapse
minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height());
//}
if (percent_visible) {
minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height());
} else { // this is needed, else the progressbar will collapse
minimum_size.width = MAX(minimum_size.width, 1);
minimum_size.height = MAX(minimum_size.height, 1);
}
return minimum_size;
}

Expand Down

0 comments on commit ce615c1

Please sign in to comment.