diff options
author | 2020-09-15 13:00:38 +0200 | |
---|---|---|
committer | 2020-11-26 03:09:46 +0100 | |
commit | 955b62ea2deec383fe693d169dba8d35633876a3 (patch) | |
tree | 82b44c17bfb8299b9aa0c5632e11c39546fb9789 | |
parent | 9991a894286a52dc81c1f8e449a64395bbe5b5fe (diff) | |
download | iced-955b62ea2deec383fe693d169dba8d35633876a3.tar.gz iced-955b62ea2deec383fe693d169dba8d35633876a3.tar.bz2 iced-955b62ea2deec383fe693d169dba8d35633876a3.zip |
fix slider handle_offset formula
change :
let handle_offset = (bounds.width - handle_width) * ((value - range_start) / (range_end - range_start).max(1.0))
to :
let handle_offset = (bounds.width - handle_width) * ((value - range_start) / (range_end - range_start).max(f32::EPSILON)).max(0.0).min(1.0)
-rw-r--r-- | graphics/src/widget/slider.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs index 9a4af9ac..87780d38 100644 --- a/graphics/src/widget/slider.rs +++ b/graphics/src/widget/slider.rs @@ -88,7 +88,7 @@ where }; let handle_offset = (bounds.width - handle_width) - * ((value - range_start) / (range_end - range_start).max(1.0)); + * ((value - range_start) / (range_end - range_start).max(f32::EPSILON)).max(0.0).min(1.0); let handle = Primitive::Quad { bounds: Rectangle { |