From 03064002bfbdbb10abe451d0f8dcfe7c6992e592 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 29 Jan 2012 15:51:04 +0000 Subject: Clamp ui::Slider value while dragging. --- src/ui/slider.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/slider.cc b/src/ui/slider.cc index c1b473c..9166656 100644 --- a/src/ui/slider.cc +++ b/src/ui/slider.cc @@ -164,7 +164,7 @@ void Slider::on_mousemove(const math::Vector2f &cursor) math::clamp(x, 2.0f * height(), width() - 2.0f * height()); const float w = (width() - 4.0f * height()); const float s = w / (slider_maximum - slider_minimum); - const float p = cursor.x() - 2.0f * height(); + const float p = x - 2.0f * height(); const float newvalue = slider_minimum + round(p /s); if (slider_value != newvalue) { slider_value = newvalue; -- cgit v1.2.3