diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2020-01-02 14:05:41 -0500 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-01-13 15:57:20 +0100 |
commit | b6ea86497000a907c964586dc771d0c2077c1652 (patch) | |
tree | 46c28ebbaa2cf4593c8fab3dc2eb110538a69b7a | |
parent | bbdab35a7a911859c2f6ed2e110c5f81d7455f4e (diff) | |
download | efl-b6ea86497000a907c964586dc771d0c2077c1652.tar.gz |
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 <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11006
-rw-r--r-- | src/lib/elementary/efl_ui_spin_button.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index 514272fae4..6dc0dbe897 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 |