From 00006863cb9b7438c1259bda9ab0772afe3f39d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Wed, 19 Apr 2017 23:00:36 +0200 Subject: Remove two TODOs in Slider. Clamp new_value in Slider::setValue. --- plugingui/slider.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugingui/slider.cc') diff --git a/plugingui/slider.cc b/plugingui/slider.cc index b558468..41ffb01 100644 --- a/plugingui/slider.cc +++ b/plugingui/slider.cc @@ -45,9 +45,15 @@ Slider::Slider(Widget* parent) : Widget(parent) void Slider::setValue(float new_value) { - // TODO make sure that we get values in range [0, 1] - current_value = new_value; + if (current_value < 0.) + { + current_value = 0.; + } + else if (current_value > 1.0) { + current_value = 1.0; + } + redraw(); clickNotifier(); valueChangedNotifier(current_value); -- cgit v1.2.3