From: Mike Blumenkrantz Date: Thu, 2 Jan 2020 19:05:41 +0000 (-0500) Subject: efl_ui/spin_button: fix step clamping X-Git-Tag: submit/tizen/20200113.211917~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3be3b9a472ceeea9a474d8ee46af83d0cf5ab20;p=platform%2Fupstream%2Fefl.git efl_ui/spin_button: fix step clamping values for this needs to be rounded off the step in order to be expected step-values and not just double garbage Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11006 --- diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index 2bdc6a9..d69e470 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -405,10 +405,11 @@ static void _spin_value(Efl_Ui_Spin *obj, Eina_Bool inc) { Efl_Ui_Spin_Button_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_BUTTON_CLASS); + double val = efl_ui_range_value_get(obj); + double step = inc ? pd->step : -pd->step; - double absolut_value = efl_ui_range_value_get(obj) + (inc ? pd->step : -pd->step); - - _value_set(obj, absolut_value); + /* clamp to step before setting new value */ + _value_set(obj, round((val + step) / step) * step); } static void