Skip to content

Commit

Permalink
Clamp volume slider scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
JManch committed Feb 9, 2025
1 parent 3dcf8aa commit 4e619c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/widgets/auxcontrols.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package widgets

import (
"math"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/lang"
Expand Down Expand Up @@ -129,7 +131,7 @@ func (v *volumeSlider) MinSize() fyne.Size {
}

func (v *volumeSlider) Scrolled(e *fyne.ScrollEvent) {
v.SetValue(v.Value + float64(0.5*e.Scrolled.DY))
v.SetValue(v.Value + math.Max(-10, math.Min(10, float64(0.5*e.Scrolled.DY))))
}

type VolumeControl struct {
Expand Down

0 comments on commit 4e619c0

Please sign in to comment.