Better clamping in scrollwheel widget.

This commit is contained in:
2026-01-26 03:02:29 -05:00
parent 9e1f150bf4
commit f56e86f34b

View File

@ -4,6 +4,7 @@
#include <Fl/Fl_Window.H>
#include <Fl/Fl_Value_Slider.H>
#include <iostream>
void saverChosen();
void perfChosen();
@ -31,7 +32,13 @@ class MouseWheelSlider : public Fl_Value_Slider
// Negative, because I use this for the Brightness control.
const int dy= -Fl::event_dy();
value( value() - dy * step() );
const int newVal= value() - dy * step();
if( 0 ) std::cerr << "newVal: " << newVal << " max: " << maximum() << " min: " << minimum() << std::endl;
if( newVal >= maximum()
and newVal <= minimum() )
{
value( newVal );
}
do_callback();