Fix ProgressBar Wrong Value with Border

Closes: #30969

The FG rectangle of the progressbar is incorrect when dealing with a non-zero border. This issue stems from wrong order of operations when drawing the rectangle: int p = r * get_size().width - mp;


(cherry picked from commit 7db96e22dd)
This commit is contained in:
Emmanuel Barroga 2019-07-30 21:47:11 -07:00 committed by Rémi Verschelde
parent b7e2266dc5
commit 45e4f467e7
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ void ProgressBar::_notification(int p_what) {
draw_style_box(bg, Rect2(Point2(), get_size())); draw_style_box(bg, Rect2(Point2(), get_size()));
float r = get_as_ratio(); float r = get_as_ratio();
int mp = fg->get_minimum_size().width; int mp = fg->get_minimum_size().width;
int p = r * get_size().width - mp; int p = r * (get_size().width - mp);
if (p > 0) { if (p > 0) {
draw_style_box(fg, Rect2(Point2(), Size2(p + fg->get_minimum_size().width, get_size().height))); draw_style_box(fg, Rect2(Point2(), Size2(p + fg->get_minimum_size().width, get_size().height)));