diff --git a/ui/slider.go b/ui/slider.go index 1c9c66f..f180a68 100644 --- a/ui/slider.go +++ b/ui/slider.go @@ -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 }