FIx: progress bar containing markers overflow. (#1310)
@git-f0x fixed overflow issue for progress bar, Thanks for pointing out the issue. - [x] I have disclosed use of any AI generated code in my commit messages. - If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR. - In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
This commit is contained in:
commit
cca48bc29e
1 changed files with 14 additions and 4 deletions
|
|
@ -223,8 +223,8 @@ where
|
|||
border.radius.bottom_left = border_radius;
|
||||
|
||||
if total_progress_width < radius.min(bounds.height / 2.0) {
|
||||
height =
|
||||
bounds.height - 2.0 * radius.min(bounds.height / 2.0) + total_progress_width * 2.0;
|
||||
height = bounds.height - 2.0 * radius.min(bounds.height / 2.0)
|
||||
+ total_progress_width * 2.0;
|
||||
}
|
||||
} else {
|
||||
border.radius.top_left = 0.0;
|
||||
|
|
@ -279,7 +279,16 @@ where
|
|||
};
|
||||
let x_start = seg_lo * drawable + i as f32 * gap;
|
||||
let x_width = (seg_hi - seg_lo) * drawable;
|
||||
let segment_radius = [r_left, r_right, r_right, r_left].into();
|
||||
|
||||
let mut segment_radius = if i == 0 && len == 0 {
|
||||
[r_left, r_right, r_right, r_left].into()
|
||||
} else if i == 0 {
|
||||
[r_left, 0.0, 0.0, r_left].into()
|
||||
} else if i == len {
|
||||
[0.0, r_right, r_right, 0.0].into()
|
||||
} else {
|
||||
[0.0, 0.0, 0.0, 0.0].into()
|
||||
};
|
||||
|
||||
// draw track segment
|
||||
draw_quad(
|
||||
|
|
@ -298,7 +307,8 @@ where
|
|||
// draw bar segment
|
||||
if current_p > seg_lo {
|
||||
let fill = ((current_p - seg_lo) / (seg_hi - seg_lo)).min(1.0);
|
||||
absolute_width += x_width * fill;
|
||||
absolute_width += x_width * fill + if i == 0 { 0.0 } else { gap };
|
||||
segment_radius = [r_left, r_right, r_right, r_left].into();
|
||||
draw_quad(
|
||||
x_start * bounds.width,
|
||||
x_width * fill * bounds.width,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue