From 904b7b95b1a521fafd6159b3cbeda1413d41b78e Mon Sep 17 00:00:00 2001 From: Aadil127 <211808495+Aadil127@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:56:56 +0530 Subject: [PATCH 1/2] Fix progress bar containing some width now does not overflow. --- src/widget/progress_bar/linear.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/widget/progress_bar/linear.rs b/src/widget/progress_bar/linear.rs index e978e03..0a0a907 100644 --- a/src/widget/progress_bar/linear.rs +++ b/src/widget/progress_bar/linear.rs @@ -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,13 @@ 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 { + [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 +304,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 + gap; + segment_radius = [r_left, r_right, r_right, r_left].into(); draw_quad( x_start * bounds.width, x_width * fill * bounds.width, From 80b370d23062bdc3d55cac06b6b475f35e3c1a26 Mon Sep 17 00:00:00 2001 From: Aadil127 <211808495+Aadil127@users.noreply.github.com> Date: Wed, 10 Jun 2026 23:35:29 +0530 Subject: [PATCH 2/2] Fix bug in progress bar. --- src/widget/progress_bar/linear.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widget/progress_bar/linear.rs b/src/widget/progress_bar/linear.rs index 0a0a907..b8e9245 100644 --- a/src/widget/progress_bar/linear.rs +++ b/src/widget/progress_bar/linear.rs @@ -279,7 +279,10 @@ where }; let x_start = seg_lo * drawable + i as f32 * gap; let x_width = (seg_hi - seg_lo) * drawable; - let mut segment_radius = if i == 0 { + + 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() @@ -304,7 +307,7 @@ 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 + gap; + 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,