flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Updated HorizontalFlowLayout with new property, useChildWidth (defaults to false for compatibility), which when set to true provides a simple flow layout with no extra loops or work.
Date Mon, 05 Dec 2016 17:05:46 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 83c309189 -> 1f879db68


Updated HorizontalFlowLayout with new property, useChildWidth (defaults to false for compatibility),
which when set to true provides a simple flow layout with no extra loops or work.


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

Branch: refs/heads/develop
Commit: 1f879db68e5d7146a260efd1d9349bb1fb69014e
Parents: 83c3091
Author: Peter Ent <pent@apache.org>
Authored: Mon Dec 5 12:05:43 2016 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Mon Dec 5 12:05:43 2016 -0500

----------------------------------------------------------------------
 .../html/beads/layouts/HorizontalFlowLayout.as  | 32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f879db6/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlowLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlowLayout.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlowLayout.as
index 345bcfc..8f3561a 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlowLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlowLayout.as
@@ -76,6 +76,7 @@ package org.apache.flex.html.beads.layouts
 		private var _computedColumnWidth:Number = Number.NaN;
 		private var _columnGap:int = 4;
 		private var _rowGap:int = 4;
+		private var _useChildWidth:Boolean = false;
 		
 		/**
 		 *  The amount of spacing between the columns.
@@ -150,6 +151,24 @@ package org.apache.flex.html.beads.layouts
 		{
 			_computedColumnWidth = value;
 		}
+		
+		/**
+		 *  Determines whether or not each child's width is set from the column size (false) or
+		 *  uses its own width (true). Default is false.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get useChildWidth():Boolean
+		{
+			return _useChildWidth;
+		}
+		public function set useChildWidth(value:Boolean):void
+		{
+			_useChildWidth = value;
+		}
 
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
@@ -195,10 +214,9 @@ package org.apache.flex.html.beads.layouts
 					
 					child.x = xpos;
 					child.y = ypos;
-					child.setWidth(useWidth)
-					//child.explicitWidth = useWidth;
-					//child.width = useWidth; // to trigger child layout
-					//child.dispatchEvent(new Event("layoutNeeded"));
+					if (!useChildWidth) {
+						child.setWidth(useWidth)
+					}
 					
 					var childWidth:Number = child.width;
 					var childHeight:Number = child.height;
@@ -250,7 +268,11 @@ package org.apache.flex.html.beads.layouts
 					else if (!isNaN(child.percentWidth)) useWidth = host.width * (child.percentWidth/100.0);
 					else useWidth = _computedColumnWidth;
 					
-					child.width = useWidth;
+					if (useChildWidth) {
+						children[i].style["position"] = null;
+					} else {
+						child.width = useWidth;
+					}
 					children[i].style["margin-top"] = String(_rowGap/2)+"px";
 					children[i].style["margin-bottom"] = String(_rowGap/2)+"px";
 					children[i].style["margin-left"] = String(_columnGap/2)+"px";


Mime
View raw message