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 2021/01/04 06:38:56 UTC

[royale-asjs] branch ChildResize updated: try to fix #1021

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


The following commit(s) were added to refs/heads/ChildResize by this push:
     new 8920c39  try to fix #1021
8920c39 is described below

commit 8920c39dfd136e03c774afc5704712b4ca3a0aaa
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 3 22:38:09 2021 -0800

    try to fix #1021
---
 .../main/royale/spark/components/beads/GroupView.as | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/GroupView.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/GroupView.as
index a1186e7..619c5b2 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/GroupView.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/GroupView.as
@@ -69,11 +69,26 @@ public class GroupView extends org.apache.royale.html.beads.GroupView
     {
         var host:GroupBase = _strand as GroupBase;
         // some Groups have left/right but are still sized to content.
-        // the left/right create padding instead.  So isntead of
-        // isWidthSizedToContent, we only check explicit and percent
-        if (host.isWidthSizedToContent() || host.isHeightSizedToContent())
+        // the left/right create padding instead.  So instead of
+        // isWidthSizedToContent, we only check explicit
+        if (!(!isNaN(host.explicitWidth) && !isNaN(host.explicitHeight)))
         {
+			var lastMeasuredWidth:Number = host.measuredWidth;
+			var lastMeasuredHeight:Number = host.measuredHeight;
             host.layout.measure();
+			if (lastMeasuredWidth != host.measuredWidth || 
+				lastMeasuredHeight != host.measuredHeight)
+			{
+		        if (!(host.isWidthSizedToContent() || host.isHeightSizedToContent()))
+				{
+					// afterlayout is not going to run layout, but might
+					// need one if percentages are involved
+					if (!isNaN(host.percentWidth) || !isNaN(host.percentHeight))
+					{
+		                (host.parent as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));   
+					}
+				}			
+			}
         }
 		return true;
     }