void HSlider::button_press(int x, int y, unsigned btn)
{
- if(geom.is_inside(x, y))
+ if(geom.is_inside_relative(x, y) && max>min)
{
- int sx=geom.x+static_cast<int>((geom.w-slider_size)*(value-min)/(max-min));
+ int sx=static_cast<int>((geom.w-slider_size)*(value-min)/(max-min));
if(btn==1 && x>=sx && x<static_cast<int>(sx+slider_size))
start_drag(x);
}
void HSlider::button_release(int, int, unsigned btn)
{
- if(btn==1)
+ if(btn==1 && dragging)
end_drag();
}