You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/12/16 07:13:58 UTC

[royale-asjs] branch ChildResize updated (8d9bb55 -> 5787649)

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a change to branch ChildResize
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from 8d9bb55  Merge branch 'ChildResize' of https://github.com/apache/royale-asjs into ChildResize
     new 11c1735  stop forcing size of DG to 200x200 and try measuring based on rowHeight and number of rows in DG when set
     new 5787649  invalidateSize if children are growing during layout.  It means that a child that was sizedToContent was re-measured or otherwise got a new size so the parent's size is invalid unless both explicitly set.  Even for percentage sizing the min size of the parent depends on the children's size

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../MXRoyale/src/main/resources/defaults.css         |  2 --
 .../mx/controls/listClasses/DataGridListBase.as      | 20 ++++++++++++++++++++
 .../spark/layouts/supportClasses/SparkLayoutBead.as  | 11 ++++++++++-
 3 files changed, 30 insertions(+), 3 deletions(-)


[royale-asjs] 01/02: stop forcing size of DG to 200x200 and try measuring based on rowHeight and number of rows in DG when set

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch ChildResize
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 11c17357f1b148c7f91cdfe35496bb4423be8403
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 15 23:11:59 2020 -0800

    stop forcing size of DG to 200x200 and try measuring based on rowHeight and number of rows in DG when set
---
 .../MXRoyale/src/main/resources/defaults.css         |  2 --
 .../mx/controls/listClasses/DataGridListBase.as      | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 1210045..a5e2d7a 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -242,8 +242,6 @@ DataGrid
 	
 	background-color: #FFFFFF;
 	border: 1px solid #222222;
-	width: 200px;
-	height: 200px;
 }
 
 DataGridColumnList {
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
index 29dc2f9..f683db4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
@@ -74,6 +74,7 @@ import org.apache.royale.core.IParent;
 import org.apache.royale.core.ISelectionModel;
 import org.apache.royale.core.IUIBase;
 import org.apache.royale.events.Event;
+import org.apache.royale.events.IEventDispatcher;
 import org.apache.royale.events.MouseEvent;
 import org.apache.royale.geom.Point;
 import org.apache.royale.utils.loadBeadFromValuesManager;
@@ -580,6 +581,18 @@ public class DataGridListBase extends ListBase /* extends UIComponent
         clearSelectionData();
         (model as ISelectionModel).selectedIndex = -1;
         super.dataProvider = value;
+		if (isWidthSizedToContent() || isHeightSizedToContent()) 
+		{
+			invalidateSize();
+			if (parent) 
+			{
+				// if we're sized to content and parent doesn't have explicitWidth
+				// meaning it is sizedToContent or may be % but depending on
+				// minHeight measurement, then force a layout
+				if (isHeightSizedToContent() && isNaN((parent as UIComponent).explicitHeight))			
+					(parent as IEventDispatcher).dispatchEvent("layoutNeeded");
+			}
+		}
 
     }
 
@@ -1747,6 +1760,13 @@ public class DataGridListBase extends ListBase /* extends UIComponent
         addClipMask((offscreenExtraRowsTop != oldoffscreenExtraRowsTop) || (offscreenExtraRowsBottom != oldoffscreenExtraRowsBottom));
     } */
 
+    override public function get measuredHeight():Number
+    {
+		if (dataProvider && dataProvider.length && !isNaN(rowHeight))
+		    return dataProvider.length * rowHeight;
+		return super.measuredHeight;
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Properties


[royale-asjs] 02/02: invalidateSize if children are growing during layout. It means that a child that was sizedToContent was re-measured or otherwise got a new size so the parent's size is invalid unless both explicitly set. Even for percentage sizing the min size of the parent depends on the children's size

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch ChildResize
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 578764997cbe51f505ff30b871cbf0282c0467a6
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 15 23:13:36 2020 -0800

    invalidateSize if children are growing during layout.  It means that a child that was sizedToContent was re-measured or otherwise got a new size so the parent's size is invalid unless both explicitly set.  Even for percentage sizing the min size of the parent depends on the children's size
---
 .../royale/spark/layouts/supportClasses/SparkLayoutBead.as    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
index 96a59ab..34b57d0 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
@@ -183,7 +183,16 @@ public class SparkLayoutBead extends org.apache.royale.core.LayoutBase
 	
 	override protected function childResizeHandler(event:Event):void
 	{
-		if (inUpdateDisplayList) return;
+		if (inUpdateDisplayList) 
+		{
+			// children are resizing during layout.
+			if (isNaN(target.explicitWidth) || isNaN(target.explicitHeight))
+			{
+				// that means our we need to be re-measured
+				target.invalidateSize();
+			}
+			return;
+		}
 		ranLayout = false;
 		super.childResizeHandler(event); // will set ranLayout if it did
 		if (!ranLayout)