- T modprop;
- if (_step > 0) {
- T scrollval = 0;
- if(_scroll > 0) {
- // calculate scroll amount (for odometer like movement)
- T remainder = _step - fmod(fabs(property), _step);
- if (remainder < _scroll) {
- scrollval = (_scroll - remainder) / _scroll * _step;
- }
- }
- // apply stepping of input value
- if(property > 0)
- modprop = ((floor(property/_step) * _step) + scrollval);
- else
- modprop = ((ceil(property/_step) * _step) + scrollval);
- } else {
- modprop = property;
- }
+ if( _step <= SGLimits<T>::min() ) return property;
+
+ // apply stepping of input value
+ T modprop = floor(property/_step)*_step;
+
+ // calculate scroll amount (for odometer like movement)
+ T remainder = property <= SGLimits<T>::min() ? -fmod(property,_step) : (_step - fmod(property,_step));
+ if( remainder > SGLimits<T>::min() && remainder < _scroll )
+ modprop += (_scroll - remainder) / _scroll * _step;
+