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)
This commit is contained in:
rubik83 2020-09-15 13:00:38 +02:00 committed by Héctor Ramón Jiménez
parent 9991a89428
commit 955b62ea2d
1 changed files with 1 additions and 1 deletions

View File

@ -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 {