Prevent drawing progress bar with negative values

This commit is contained in:
William Brawner 2022-04-15 20:16:33 -06:00
parent 9f0c795c34
commit 35656383e9

View file

@ -32,7 +32,7 @@ struct ProgressView: View {
private func getProgressBarWidth(geometry: GeometryProxy) -> CGFloat { private func getProgressBarWidth(geometry: GeometryProxy) -> CGFloat {
let frame = geometry.frame(in: .global) let frame = geometry.frame(in: .global)
return frame.size.width * min(CGFloat(value / maxValue), CGFloat(1)) return max(0, frame.size.width * min(CGFloat(value / maxValue), CGFloat(1)))
} }
} }