(Re)fix bug #285, textranslate broken

Due to fingertrouble, I removed the check for _step == 0 which
this patch re-adds.

Also, make this function look more like a template by not using
0.0 - constants.
This commit is contained in:
Torsten Dreyer
2011-05-28 10:17:19 +02:00
parent b06e38699a
commit 83a95a0488

View File

@@ -665,12 +665,14 @@ public:
private:
T apply_mods(T property) const
{
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 < 0 ? -fmod(property,_step) : (_step - fmod(property,_step));
if( remainder > 0.0 && remainder < _scroll )
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;
return modprop;