You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/05/24 09:31:58 UTC
[4/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-19055
Changed "snap" value to be a function of the range (1/1000 th)
FLEX-19055 Changed "snap" value to be a function of the range (1/1000 th)
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/0e98aca7
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/0e98aca7
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/0e98aca7
Branch: refs/heads/develop
Commit: 0e98aca75bb14b53a4dbc7d4891a4365737b3cf9
Parents: 05cd3da
Author: Justin Mclean <jm...@apache.org>
Authored: Fri May 24 17:24:45 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Fri May 24 17:24:45 2013 +1000
----------------------------------------------------------------------
.../mx/src/mx/controls/sliderClasses/Slider.as | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0e98aca7/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as b/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
index 1a3870f..c621781 100644
--- a/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
+++ b/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
@@ -2581,13 +2581,15 @@ public class Slider extends UIComponent
var v:Number = (xPos - track.x) *
(maximum - minimum) /
(track.width) + minimum;
+
+ var threshold:Number = (maximum - minimum) / 1000;
// kill rounding error at the edges.
- if (v - minimum <= 0.002)
+ if (v - minimum <= threshold)
{
v = minimum;
}
- else if (maximum - v <= 0.002)
+ else if (maximum - v <= threshold)
{
v = maximum;
}
@@ -2739,6 +2741,7 @@ public class Slider extends UIComponent
isProgrammatic:Boolean = false):void
{
var oldValue:Number = _values[index];
+ var threshold:Number = (maximum - minimum) / 1000;
// we need to do the round of (to remove the floating point error)
// if the stepSize had a fractional value
@@ -2770,7 +2773,7 @@ public class Slider extends UIComponent
if (!isNaN(oldValue))
{
- if (Math.abs(oldValue - value) > 0.002)
+ if (Math.abs(oldValue - value) > threshold)
dispatchEvent(event)
}
// Handle case of changing from NaN to a valid value