if (sd->wrap)
{
- while (new_val < sd->val_min)
- new_val = sd->val_max + new_val + 1 - sd->val_min;
- while (new_val > sd->val_max)
- new_val = sd->val_min + new_val - sd->val_max - 1;
+ if (new_val < sd->val_min)
+ new_val = sd->val_max;
+ else if (new_val > sd->val_max)
+ new_val = sd->val_min;
}
else
{
* Disabled by default. If disabled, when the user tries to increment the
* value,
* but displayed value plus step value is bigger than maximum value,
- * the spinner
- * won't allow it. The same happens when the user tries to decrement it,
- * but the value less step is less than minimum value.
+ * the new value will be the maximum value.
+ * The same happens when the user tries to decrement it,
+ * but the value less step is less than minimum value. In this case,
+ * the new displayed value will be the minimum value.
*
- * When wrap is enabled, in such situations it will allow these changes,
- * but will get the value that would be less than minimum and subtracts
- * from maximum. Or add the value that would be more than maximum to
- * the minimum.
+ * When wrap is enabled, when the user tries to increment the value,
+ * but displayed value plus step value is bigger than maximum value,
+ * the new value will be the minimum value. When the the user tries to
+ * decrement it, but the value less step is less than minimum value,
+ * the new displayed value will be the maximum value.
*
* E.g.:
* @li min value = 10
* @li displayed value = 20
*
* When the user decrement value (using left or bottom arrow), it will
- * displays @c 40, because max - (min - (displayed - step)) is
- * @c 50 - (@c 10 - (@c 20 - @c 20)) = @c 40.
+ * displays @c 50.
*
* @see elm_spinner_wrap_get().
*