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 2014/10/10 16:34:59 UTC

[12/16] git commit: [flex-asjs] [refs/heads/develop] - fix when we set the width of children

fix when we set the width of children


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

Branch: refs/heads/develop
Commit: c7e263eb34a6d6a8684e92b06c9c053869b50a1a
Parents: d6dcd95
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 9 14:27:31 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Oct 10 07:34:33 2014 -0700

----------------------------------------------------------------------
 .../html/beads/layouts/NonVirtualVerticalLayout.as     | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7e263eb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as
index 0bc1bdd..fb7977f 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalLayout.as
@@ -70,6 +70,7 @@ package org.apache.flex.html.beads.layouts
 			IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
 			IEventDispatcher(value).addEventListener("childrenAdded", changeHandler);
 			IEventDispatcher(value).addEventListener("itemsCreated", changeHandler);
+            IEventDispatcher(value).addEventListener("layoutNeeded", changeHandler);
 			IEventDispatcher(value).addEventListener("beadsAdded", changeHandler);
 		}
 	
@@ -180,6 +181,12 @@ package org.apache.flex.html.beads.layouts
 						flexibleHorizontalMargins[i].marginRight = mr;
 				}
 				child.x = ml;
+                if (child is ILayoutChild)
+                {
+                    ilc = child as ILayoutChild;
+                    if (!isNaN(ilc.percentWidth))
+                        ilc.setWidth(contentView.width * ilc.percentWidth / 100);
+                }
 				maxWidth = Math.max(maxWidth, ml + child.width + mr);
 			}
 			if (hasHorizontalFlex)
@@ -187,12 +194,6 @@ package org.apache.flex.html.beads.layouts
 				for (i = 0; i < n; i++)
 				{
 					child = contentView.getElementAt(i) as IUIBase;
-                    if (child is ILayoutChild)
-                    {
-                        ilc = child as ILayoutChild;
-                        if (!isNaN(ilc.percentWidth))
-                            ilc.setWidth(contentView.width * ilc.percentWidth / 100);
-                    }
 					var obj:Object = flexibleHorizontalMargins[i];
 					if (obj.marginLeft == "auto" && obj.marginRight == "auto")
 						child.x = maxWidth - child.width / 2;