From d42bb08e84535f8695939752b98486b439588b30 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Wed, 16 Aug 2023 12:51:43 +0200 Subject: [PATCH] Fix circular progress crashing when value is out of range fixes #682, fixes #854 --- crates/eww/src/widgets/widget_definitions.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/eww/src/widgets/widget_definitions.rs b/crates/eww/src/widgets/widget_definitions.rs index 1a0d691..eb12e75 100644 --- a/crates/eww/src/widgets/widget_definitions.rs +++ b/crates/eww/src/widgets/widget_definitions.rs @@ -999,9 +999,9 @@ fn build_circular_progress_bar(bargs: &mut BuilderArgs) -> Result { let w = CircProg::new(); def_widget!(bargs, _g, w, { // @prop value - the value, between 0 - 100 - prop(value: as_f64) { w.set_property("value", value); }, - // @prop start-at - the angle that the circle should start at - prop(start_at: as_f64) { w.set_property("start-at", start_at); }, + prop(value: as_f64) { w.set_property("value", value.clamp(0.0, 100.0)); }, + // @prop start-at - the percentage that the circle should start at + prop(start_at: as_f64) { w.set_property("start-at", start_at.clamp(0.0, 100.0)); }, // @prop thickness - the thickness of the circle prop(thickness: as_f64) { w.set_property("thickness", thickness); }, // @prop clockwise - wether the progress bar spins clockwise or counter clockwise