flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [38/50] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - handle centering
Date Mon, 01 May 2017 03:48:37 GMT
handle centering


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

Branch: refs/heads/develop
Commit: 712a17e799fa8d53a352ece9022bbf9602f199b9
Parents: 7de620a
Author: Alex Harui <aharui@apache.org>
Authored: Wed Apr 26 22:49:27 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Apr 27 14:15:18 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/layouts/BasicLayout.as   | 12 ++++++++++++
 .../apache/flex/html/beads/layouts/HorizontalLayout.as  |  9 +++++----
 .../apache/flex/html/beads/layouts/VerticalLayout.as    |  7 ++-----
 3 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/712a17e7/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
index 72c42d8..a7a54ac 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
@@ -126,9 +126,13 @@ package org.apache.flex.html.beads.layouts
 							else
 							{
 								if (ilc)
+								{
 									ilc.setX( w - positions.right - margins.left - child.width - margins.right);
+								}
 								else
+								{
 									child.x = w - positions.right - margins.left - child.width - margins.right;
+								}
 							}
 						}
 					}
@@ -162,6 +166,14 @@ package org.apache.flex.html.beads.layouts
 					{
 						ilc.setHeight((hh - margins.top - margins.bottom) * ilc.percentHeight/100, false);
 					}
+					
+					if (margins.auto)
+					{
+						if (ilc)
+							ilc.setX( (w - child.width) / 2);
+						else
+							child.x = (w - child.width) / 2;
+					}
                 }
 
                 return true;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/712a17e7/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
index 148866b..89aab6e 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
@@ -147,10 +147,11 @@ package org.apache.flex.html.beads.layouts
 							childHeight = hostHeight * ilc.percentHeight/100.0;
 							ilc.setHeight(childHeight);
 						}
-						// the following code middle-aligns the child, but since HTML does not
-						// do this normally, this code is commented. (Use HorizontalFlexLayout for
-						// vertically centered elements in a horizontal row).
-//						childYpos = hostHeight/2 - (childHeight + mt + mb)/2;
+						var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+						if (valign == "middle")
+						{
+							childYpos = hostHeight/2 - (childHeight + margins.top + margins.bottom)/2;
+						}
 					}
 
 					if (ilc) {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/712a17e7/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
index a8b9774..6357e9f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@ -126,12 +126,9 @@ package org.apache.flex.html.beads.layouts
 							childWidth = hostWidth * ilc.percentWidth/100.0;
 							ilc.setWidth(childWidth);
 						}
-						// the following code center-aligns the child, but since HTML does not
-						// do this normally, this code is commented. (Use VerticalFlexLayout for
-						// horizontally centered elements in a vertical column).
-						//					childXpos = hostWidth/2 - (childWidth + ml + mr)/2;
+						if (margins.auto)
+							childXpos = (hostWidth - childWidth) / 2;
 					}
-
 					if (ilc) {
 						ilc.setX(childXpos);
 						ilc.setY(ypos);


Mime
View raw message