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 2014/02/13 02:31:30 UTC
[08/11] git commit: [flex-sdk] [refs/heads/release4.12.0] -
FLEX-34053 - MaskedTextInput - Implement windows exclusive 'Insert' key
behaviour in MaskedTextInput Component
FLEX-34053 - MaskedTextInput - Implement windows exclusive 'Insert' key behaviour in MaskedTextInput Component
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/7549aa18
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/7549aa18
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/7549aa18
Branch: refs/heads/release4.12.0
Commit: 7549aa18410511b008c985a58481cf127c0a4400
Parents: 96ba4bc
Author: Carlos Rovira <ca...@apache.org>
Authored: Mon Feb 10 18:33:46 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Mon Feb 10 18:33:46 2014 +0100
----------------------------------------------------------------------
.../src/spark/components/MaskedTextInput.as | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/7549aa18/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 2bf3e94..510d3a6 100644
--- a/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
+++ b/frameworks/projects/experimental/src/spark/components/MaskedTextInput.as
@@ -20,6 +20,8 @@ package spark.components {
import flash.events.Event;
import flash.events.TextEvent;
+ import flashx.textLayout.edit.EditManager;
+
import flashx.textLayout.edit.SelectionState;
import flashx.textLayout.operations.CompositeOperation;
import flashx.textLayout.operations.CopyOperation;
@@ -375,7 +377,17 @@ package spark.components {
var insertOp:InsertTextOperation = event.operation as InsertTextOperation;
if (insertOp.deleteSelectionState != null && !insertOp.deleteSelectionState.tlf_internal::selectionManagerOperationState) {
//OVERRIDING INSERT
- if (isSeparator(ac)) {
+ if (EditManager.overwriteMode) {
+ //windows insert mode on (note that Flash Player does not track insertion mode state before running a SWF)
+ if (isSeparator(ac - 1)) {
+ outputText = super.text.substring(0, insertOp.originalSelectionState.anchorPosition + 1) + super.text.substring(insertOp.originalSelectionState.anchorPosition + 2);
+ } else {
+ outputText = super.text;
+ }
+ an -= 1;
+ ac -= 1;
+ }
+ else if (isSeparator(ac)) {
outputText = super.text.substring(0, insertOp.originalSelectionState.anchorPosition + 1) + insertOp.text + super.text.substring(insertOp.originalSelectionState.activePosition + 1);
} else {
outputText = super.text.substring(0, insertOp.originalSelectionState.anchorPosition) + insertOp.text + super.text.substring(insertOp.originalSelectionState.activePosition);
@@ -392,7 +404,7 @@ package spark.components {
ac = ac + 1;
}
} else {
-
+ //INSERT (TEXT NOT COMPLETE)
for (var i:int = 0; i < maskText.length; i++) {
if (stack.length == 0) {
break;
@@ -467,6 +479,11 @@ package spark.components {
* @param event the TextEvent
*/
protected function overrideText(event:TextEvent):void {
+ //windows insert mode on (note that Flash Player does not track insertion mode state before running a SWF)
+ if (EditManager.overwriteMode) {
+ return;
+ }
+
var an:int = selectionAnchorPosition;
var ac:int = selectionActivePosition;