r2089 - trunk/ui

r2089 - trunk/ui


Author: paul.bakaus
Date: Tue Feb 17 05:01:19 2009
New Revision: 2089
Modified:
trunk/ui/ui.slider.js
Log:
slider: limit the returned floats to 5 digits after the decimal point,
corrects JS float errors (fixes #4124 - Value should always be constrained
to valid step values)
Modified: trunk/ui/ui.slider.js
==============================================================================
--- trunk/ui/ui.slider.js    (original)
+++ trunk/ui/ui.slider.js    Tue Feb 17 05:01:19 2009
@@ -287,7 +287,9 @@
        if (valueMouseModStep > (this.options.step / 2))
            normValue += this.options.step;
-        return normValue;
+        // Since JavaScript has problems with large floats, round
+        // the final value to 5 digits after the decimal point (see #4124)
+        return parseFloat(normValue.toFixed(5));
    },