flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-34053 - MaskedTextInput - fixed a case when override text (text is complete) and user makes a selection (1 or + characters) and then inserts a character. Now this case is supported.
Date Fri, 07 Feb 2014 09:46:37 GMT
Updated Branches:
  refs/heads/develop e32b49b39 -> dcf12f943


FLEX-34053 - MaskedTextInput - fixed a case when override text (text is complete) and user
makes a selection (1 or + characters) and then inserts a character. Now this case is supported.


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

Branch: refs/heads/develop
Commit: dcf12f943e1e70da8ec7e2aeb159a5589c30c155
Parents: e32b49b
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Fri Feb 7 10:46:16 2014 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Fri Feb 7 10:46:16 2014 +0100

----------------------------------------------------------------------
 .../experimental/src/spark/components/MaskedTextInput.as  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcf12f94/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as b/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
index 8286822..3058c18 100644
--- a/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
+++ b/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
@@ -372,15 +372,17 @@ package spark.components {
             }
             //insert
             else if (event.operation is InsertTextOperation) {
-
-                if ((event.operation as InsertTextOperation).deleteSelectionState != null)
{
+                var insertOp:InsertTextOperation = event.operation as InsertTextOperation;
+                if (insertOp.deleteSelectionState != null) {
                     //OVERRIDING INSERT
                     if (ac < maxChars && isSeparator(ac)) {
-                        outputText = super.text.substring(0, ac + 1) + (event.operation as
InsertTextOperation).text + super.text.substring(ac + 2);
+                        outputText = super.text.substring(0, insertOp.originalSelectionState.anchorPosition
+ 1) + (event.operation as InsertTextOperation).text + super.text.substring(insertOp.originalSelectionState.activePosition
+ 2);
                     } else {
-                        outputText = super.text.substring(0, ac) + (event.operation as InsertTextOperation).text
+ super.text.substring(ac + 1);
+                        outputText = super.text.substring(0, insertOp.originalSelectionState.anchorPosition)
+ (event.operation as InsertTextOperation).text + super.text.substring(insertOp.originalSelectionState.activePosition);
                     }
 
+                    outputText = formatTextWithMask(cleanText(outputText));
+
                     if (isSeparator(ac)) {
                         an = an + 2;
                         ac = ac + 2;


Mime
View raw message