Fixed bug in slider when maximum equal to or less than the minimum was supplied.

This commit is contained in:
Sander Schobers 2021-01-14 11:44:17 +01:00
parent dbeacc3794
commit 7aa88e2dc6

View File

@ -90,7 +90,10 @@ func (s *Slider) Arrange(ctx Context, bounds geom.RectangleF32, offset geom.Poin
start, length, center := s.offsets()
w := s.handleWidth
w05 := .5 * w
handleOffset := (s.Value - s.Minimum) / (s.Maximum - s.Minimum)
var handleOffset float32
if s.Maximum > s.Minimum {
handleOffset = (s.Value - s.Minimum) / (s.Maximum - s.Minimum)
}
if !geom.IsNaN32(handleOffset) {
start += handleOffset * length
}