You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ma...@apache.org on 2014/03/29 13:49:30 UTC

[1/2] git commit: [flex-sdk] [refs/heads/develop] - FIXED - FLEX-24502 Mobile optimized skins and item renderers don't show text when mirrored

Repository: flex-sdk
Updated Branches:
  refs/heads/develop a9871ce84 -> 3cd078e7d


FIXED - FLEX-24502 Mobile optimized skins and item renderers don't show text when mirrored


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

Branch: refs/heads/develop
Commit: 6a269c3aaedb8f271909b35834bd4ba832faa9f3
Parents: 332980d
Author: mamsellem <ma...@systar.com>
Authored: Sat Mar 29 13:45:52 2014 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Sat Mar 29 13:45:52 2014 +0100

----------------------------------------------------------------------
 .../supportClasses/StyleableTextField.as        | 79 +++++++++++++++++++-
 1 file changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6a269c3a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as
index fd674de..1b74e1d 100644
--- a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as
+++ b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/StyleableTextField.as
@@ -49,6 +49,7 @@ import mx.core.FlexGlobals;
 import mx.core.FlexTextField;
 import mx.core.IInvalidating;
 import mx.core.IVisualElement;
+import mx.core.LayoutDirection;
 import mx.core.UIComponent;
 import mx.core.mx_internal;
 import mx.events.FlexEvent;
@@ -214,6 +215,66 @@ public class StyleableTextField extends FlexTextField
             invalidateTightTextHeight = true;
             invalidateTextSizeFlag = true;
         }
+        validateTransformMatrix();
+    }
+
+    /**
+     *  @private
+     *  True if we've inherited layoutDirection="rtl".
+     *  (implementation largely inspired from UITextField)
+     */
+    private var mirror: Boolean = false;
+
+    //----------------------------------
+    //  x
+    //----------------------------------
+
+    private var _x: Number = 0;
+
+    /**
+     *  @private
+     */
+    override public function set x(value: Number): void
+    {
+        _x = value;
+        super.x = value;
+        validateTransformMatrix();
+    }
+
+    /**
+     *  @private
+     */
+    override public function get x(): Number
+    {
+           return (mirror) ? _x : super.x;
+    }
+
+    /**
+     *  @private
+     *  Update the transform.matrix based on the mirror flag.  This method must be
+     *  called when x, width, or layoutDirection changes.
+     */
+    private function validateTransformMatrix(): void
+    {
+        if (mirror) {
+            var mirrorMatrix: Matrix = this.transform.matrix;
+            // matrix a must be negative
+            if (mirrorMatrix.a > 0){
+                mirrorMatrix.a = -mirrorMatrix.a;
+            }
+            mirrorMatrix.tx = _x + width;
+            transform.matrix = mirrorMatrix;
+        }
+        else // layoutDirection changed, mirror=false, reset transform.matrix to its default
+        {
+            var defaultMatrix: Matrix = this.transform.matrix;
+            if (defaultMatrix.a < 0) {
+                defaultMatrix.a = -defaultMatrix.a;
+            }
+            defaultMatrix.tx = _x;
+            defaultMatrix.ty = y;
+            transform.matrix = defaultMatrix;
+        }
     }
     
     /**
@@ -1051,11 +1112,25 @@ public class StyleableTextField extends FlexTextField
     {
         if (invalidateStyleFlag)
         {
+            // compute mirror
+            const oldMirror: Boolean = mirror;
+            if (parent is IVisualElement)
+                mirror = IVisualElement(parent).layoutDirection == LayoutDirection.RTL;
+            if (mirror || oldMirror)
+                validateTransformMatrix();
+
             var align:String = getStyle("textAlign");
             if (align == "start")
                 align = TextFormatAlign.LEFT;
             if (align == "end")
                 align = TextFormatAlign.RIGHT;
+            // textalign must be mirrored as well
+            if (mirror){
+                if (align == TextFormatAlign.LEFT)
+                   align =TextFormatAlign.RIGHT;
+                else if (align == TextFormatAlign.RIGHT )
+                  align = TextFormatAlign.LEFT;
+            }
             textFormat.align = align;
             textFormat.font = getStyle("fontFamily");
             textFormat.bold = getStyle("fontWeight") == "bold";
@@ -1113,7 +1188,7 @@ public class StyleableTextField extends FlexTextField
             invalidateTightTextHeight = true;
         }
     }
-    
+
     /**
      *  @copy mx.core.UIComponent#getStyle()
      *
@@ -2164,7 +2239,7 @@ public class StyleableTextField extends FlexTextField
     mx_internal var leftMargin:Object;
     mx_internal var rightMargin:Object;
     
-    private static var supportedStyles:String = "textAlign fontFamily fontWeight fontStyle color fontSize textDecoration textIndent leading letterSpacing"
+    private static const supportedStyles:Vector.<String> = new <String>["textAlign", "fontFamily", "fontWeight", "fontStyle", "color", "fontSize"    , "textDecoration","textIndent" ,"leading" ,"letterSpacing" ,"layoutDirection"];
     
     private var invalidateStyleFlag:Boolean = true;
     


[2/2] git commit: [flex-sdk] [refs/heads/develop] - Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop

Posted by ma...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop


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

Branch: refs/heads/develop
Commit: 3cd078e7dcdefd90e25a65d86f82b2ac085fb23b
Parents: 6a269c3 a9871ce
Author: mamsellem <ma...@systar.com>
Authored: Sat Mar 29 13:49:06 2014 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Sat Mar 29 13:49:06 2014 +0100

----------------------------------------------------------------------
 .../spark/skins/mobile/supportClasses/ActionBarButtonSkinBase.as   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------