diff options
Diffstat (limited to 'graphics/src/widget/progress_bar.rs')
-rw-r--r-- | graphics/src/widget/progress_bar.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/graphics/src/widget/progress_bar.rs b/graphics/src/widget/progress_bar.rs index 932f4fc2..32ee42c6 100644 --- a/graphics/src/widget/progress_bar.rs +++ b/graphics/src/widget/progress_bar.rs @@ -31,10 +31,13 @@ where style_sheet: &Self::Style, ) -> Self::Output { let style = style_sheet.style(); - let (range_start, range_end) = range.into_inner(); - let active_progress_width = bounds.width - * ((value - range_start) / (range_end - range_start).max(1.0)); + + let active_progress_width = if range_start >= range_end { + 0.0 + } else { + bounds.width * (value - range_start) / (range_end - range_start) + }; let background = Primitive::Group { primitives: vec![Primitive::Quad { |