flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-28401 Changes so that small numbers > 0.0000001 are supported and display correctly without scientific notation
Date Mon, 06 May 2013 02:00:05 GMT
Updated Branches:
  refs/heads/develop 7071779f6 -> 659a9234f


FLEX-28401 Changes so that small numbers > 0.0000001 are supported and display correctly
without scientific notation


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/659a9234
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/659a9234
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/659a9234

Branch: refs/heads/develop
Commit: 659a9234f20deaad0d27339ae6ac53867fbda25c
Parents: 7071779
Author: Justin Mclean <jmclean@apache.org>
Authored: Mon May 6 11:57:28 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Mon May 6 11:57:28 2013 +1000

----------------------------------------------------------------------
 .../projects/mx/src/mx/controls/NumericStepper.as  |   27 ++++++++++++---
 1 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/659a9234/frameworks/projects/mx/src/mx/controls/NumericStepper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/NumericStepper.as b/frameworks/projects/mx/src/mx/controls/NumericStepper.as
index 8daf699..3c188d3 100644
--- a/frameworks/projects/mx/src/mx/controls/NumericStepper.as
+++ b/frameworks/projects/mx/src/mx/controls/NumericStepper.as
@@ -1123,6 +1123,12 @@ public class NumericStepper extends UIComponent
      *  _value will hold uncommitted values as well
      */
     private var lastValue:Number = 0;
+	
+	/**
+	 *  @private
+	 */
+	private var lastField:String = "";
+
 
     /**
      *  @private
@@ -1455,7 +1461,17 @@ public class NumericStepper extends UIComponent
             return;
 
         lastValue = _value = v;
-        inputField.text = v.toString();
+		
+		var numStr:String =  v.toString();
+		if (numStr.indexOf("e") >= 0) {
+			var parts:Array = (new String(1 + stepSize)).split(".");
+			
+			if (parts.length == 2)
+				numStr = v.toFixed(parts[1].length).toString();
+		}
+		
+        inputField.text = numStr;
+		lastField = numStr;
 
         if (sendEvent)
         {
@@ -1478,10 +1494,11 @@ public class NumericStepper extends UIComponent
     private function takeValueFromTextField(trigger:Event = null):void
     {
         var inputValue:Number = Number(inputField.text);
+		
         if ((inputValue != lastValue &&
-            (Math.abs(inputValue - lastValue) >= 0.000001 || isNaN(inputValue))) || 
-            inputField.text == "" || (inputField.text && 
-           inputField.text.length != lastValue.toString().length))
+            (Math.abs(inputValue - lastValue) >= 0.000001 || isNaN(inputValue)))
+            || inputField.text == ""
+			|| (inputField.text && inputField.text.length != lastField.length))
         {
             var newValue:Number = checkValidValue(Number(inputField.text));
             inputField.text = newValue.toString();
@@ -1642,7 +1659,7 @@ public class NumericStepper extends UIComponent
                 if (inputValue != lastValue &&
                     (Math.abs(inputValue - lastValue) >= 0.000001 ||
                      isNaN(inputValue)) || (inputField.text && 
-                    inputField.text.length != lastValue.toString().length))
+                    inputField.text.length != lastField.length))
                 {
                     var newValue:Number = checkValidValue(Number(inputField.text));
                     


Mime
View raw message