From b70467014158ba7eb7da065859ac745b9649ca07 Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Mon, 14 Jul 2025 22:46:27 -0700 Subject: [PATCH] slider: was not always sending input events for clicks, which prevented scrolling from working sometimes. also color slider. --- core/slider.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/slider.go b/core/slider.go index fac365afc0..e41f0a81c0 100644 --- a/core/slider.go +++ b/core/slider.go @@ -234,7 +234,9 @@ func (sr *Slider) Init() { }) sr.On(events.Click, func(e events.Event) { pos := sr.pointToRelPos(e.Pos()) - sr.setSliderPosEvent(pos) + if !sr.setSliderPosEvent(pos) { + sr.Send(events.Input) // always send on click even if same. + } sr.sendChange() }) sr.On(events.Scroll, func(e events.Event) { @@ -401,13 +403,15 @@ func (sr *Slider) setSliderPos(pos float32) { // setSliderPosEvent sets the position of the slider at the given position in pixels, // and updates the corresponding Value based on that position. -// This version sends input events. -func (sr *Slider) setSliderPosEvent(pos float32) { +// This version sends input events. Returns true if event sent. +func (sr *Slider) setSliderPosEvent(pos float32) bool { sr.setSliderPos(pos) if math32.Abs(sr.prevSlide-sr.Value) > sr.InputThreshold { sr.prevSlide = sr.Value sr.Send(events.Input) + return true } + return false } // setPosFromValue sets the slider position based on the given value