Better clamping in scrollwheel widget.
This commit is contained in:
@ -4,6 +4,7 @@
|
|||||||
#include <Fl/Fl_Window.H>
|
#include <Fl/Fl_Window.H>
|
||||||
#include <Fl/Fl_Value_Slider.H>
|
#include <Fl/Fl_Value_Slider.H>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
void saverChosen();
|
void saverChosen();
|
||||||
void perfChosen();
|
void perfChosen();
|
||||||
@ -31,7 +32,13 @@ class MouseWheelSlider : public Fl_Value_Slider
|
|||||||
// Negative, because I use this for the Brightness control.
|
// Negative, because I use this for the Brightness control.
|
||||||
const int dy= -Fl::event_dy();
|
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();
|
do_callback();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user