flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [15/15] git commit: [flex-asjs] [refs/heads/develop] - more tweaking of TextInput border handling
Date Wed, 05 Aug 2015 21:20:59 GMT
more tweaking of TextInput border handling


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

Branch: refs/heads/develop
Commit: c023d4b87175f8e4fc090745140b9351996d65e5
Parents: b6f4de8
Author: Alex Harui <aharui@apache.org>
Authored: Wed Aug 5 14:19:25 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Aug 5 14:19:25 2015 -0700

----------------------------------------------------------------------
 .../apache/flex/html/beads/TextFieldViewBase.as | 10 ++++-
 .../org/apache/flex/html/beads/TextInputView.as | 28 +++++++++---
 .../flex/html/beads/TextInputWithBorderView.as  | 46 +++++++-------------
 3 files changed, 45 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c023d4b8/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 0d8aeaa..3ab2874 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
@@ -375,7 +375,15 @@ package org.apache.flex.html.beads
             }
         }
         
-        private function sizeChangeHandler(event:Event):void
+        /**
+         *  Determine the size of the TextField.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected function sizeChangeHandler(event:Event):void
         {
             var ilc:ILayoutChild = host as ILayoutChild;
             autoHeight = ilc.isHeightSizedToContent();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c023d4b8/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputView.as
index ee6c1c1..c02bea1 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputView.as
@@ -97,16 +97,14 @@ package org.apache.flex.html.beads
                 ilc.setHeight(h + uiMetrics.top + uiMetrics.bottom, true);
             }
 			
-			IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
-			IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
-			sizeChangedHandler(null);
+			heightChangeHandler(null);
 		}
 		
-		private function sizeChangedHandler(event:Event):void
+        /**
+         *  @private
+         */
+        override protected function heightChangeHandler(event:Event):void
 		{
-			var ww:Number = host.width;
-			if( !isNaN(ww) && ww > 0 ) textField.width = ww;
-			
 			var hh:Number = host.height;
 			if( !isNaN(hh) && hh > 0 ) 
             {
@@ -115,5 +113,21 @@ package org.apache.flex.html.beads
             
             textField.y = ((hh - textField.height) / 2);
 		}
+        
+        /**
+         *  @private
+         */
+        override protected function sizeChangeHandler(event:Event):void
+        {
+            var ww:Number = host.width;
+            if( !isNaN(ww) && ww > 0 ) textField.width = ww;
+            
+            var hh:Number = host.height;
+            if( !isNaN(hh) && hh > 0 ) 
+            {
+                textField.height = textField.textHeight + 5;
+                textField.y = ((hh - textField.height) / 2);
+            }
+        }
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c023d4b8/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
index 16cc7a2..566a78a 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
@@ -20,14 +20,17 @@ package org.apache.flex.html.beads
 {
 	import flash.display.DisplayObject;
 	
-    import org.apache.flex.core.IBead;
-    import org.apache.flex.core.IBeadModel;
-	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IBeadModel;
+	import org.apache.flex.core.ILayoutChild;
 	import org.apache.flex.core.IParent;
-    import org.apache.flex.core.ValuesManager;
-	import org.apache.flex.html.supportClasses.Border;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.ValuesManager;
+    import org.apache.flex.core.UIMetrics;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.html.supportClasses.Border;
+	import org.apache.flex.utils.BeadMetrics;
 
     /**
      *  The TextInputWithBorderView class is the default view for
@@ -72,43 +75,24 @@ package org.apache.flex.html.beads
             {
                 textField.autoSize = "none";
                 autoWidth = false;
-                textField.width = host.width - 2;
-                textField.x = 1;
-                if (autoHeight)
-                    autoSizeIfNeeded()
-                else 
-                {
-                    textField.height = host.height - 2;
-                    textField.y = 1;
-                }
+                var uiMetrics:UIMetrics = BeadMetrics.getMetrics(host);
+                textField.width = host.width - uiMetrics.left - uiMetrics.right;
+                textField.x = uiMetrics.left;
             }
         }
         
         /**
-         *  Determine the height of the TextField.
+         *  Determine the size of the TextField.
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        override protected function heightChangeHandler(event:Event):void
+        override protected function sizeChangeHandler(event:Event):void
         {
-            if (!inHeightChange)
-            {
-                textField.autoSize = "none";
-                autoHeight = false;
-                textField.height = host.height - 2;
-                textField.y = 1;
-                if (autoWidth)
-                    autoSizeIfNeeded();
-                else
-                {
-                    textField.width = host.width;
-                    textField.x = 1;
-                }
-            }
+            super.sizeChangeHandler(event);
+            widthChangeHandler(event);
         }
-
     }
 }


Mime
View raw message