You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/07/30 20:23:49 UTC

[3/5] git commit: [flex-asjs] [refs/heads/develop] - try to figure out height if no text

try to figure out height if no text


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

Branch: refs/heads/develop
Commit: 67fa9502be5710d626814076aa5380e1d0b19ef9
Parents: a5649a5
Author: Alex Harui <ah...@apache.org>
Authored: Wed Jul 29 14:17:38 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Jul 30 10:54:53 2015 -0700

----------------------------------------------------------------------
 .../apache/flex/html/beads/TextFieldViewBase.as | 37 ++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/67fa9502/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
index f2214e2..6318bf6 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
@@ -112,6 +112,17 @@ package org.apache.flex.html.beads
             {
                 heightChangeHandler(null);
             }
+            
+            // textfield's collapse to height==4 if no text
+            if (autoHeight && _textModel.text === null)
+            {
+                var fontHeight:Number = ValuesManager.valuesImpl.getValue(_strand, "fontSize") + 4;
+                if (textField.height != fontHeight) 
+                {
+                    textField.autoSize = "none";
+                    textField.height = fontHeight;
+                }
+            }
 		}
 		
         /**
@@ -150,13 +161,27 @@ package org.apache.flex.html.beads
         {
             var host:UIBase = UIBase(_strand);
             if (autoHeight)
-            {            
-                if (textField.height != textField.textHeight + 4)
+            {   
+                if (textField.text != "")
+                {
+                    if (textField.height != textField.textHeight + 4)
+                    {
+                        textField.height = textField.textHeight + 4;
+                        inHeightChange = true;
+                        host.dispatchEvent(new Event("heightChanged"));
+                        inHeightChange = false;
+                    }
+                }
+                else
                 {
-                    textField.height = textField.textHeight + 4;
-                    inHeightChange = true;
-                    host.dispatchEvent(new Event("heightChanged"));
-                    inHeightChange = false;
+                    var fontHeight:Number = ValuesManager.valuesImpl.getValue(_strand, "fontSize") + 4;
+                    if (textField.height != fontHeight)
+                    {
+                        textField.height = fontHeight;
+                        inHeightChange = true;
+                        host.dispatchEvent(new Event("heightChanged"));
+                        inHeightChange = false;                        
+                    }
                 }
             }
             if (autoWidth)