forked from enlightenment/efl
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
This commit is contained in:
parent
bbdab35a7a
commit
b6ea864970
|
@ -405,10 +405,11 @@ static void
|
||||||
_spin_value(Efl_Ui_Spin *obj, Eina_Bool inc)
|
_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);
|
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);
|
/* clamp to step before setting new value */
|
||||||
|
_value_set(obj, round((val + step) / step) * step);
|
||||||
_value_set(obj, absolut_value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue