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/06/22 07:22:00 UTC

[royale-asjs] branch ChildResize updated: try to get measurement changes propagated bottom up

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 241c927  try to get measurement changes propagated bottom up
241c927 is described below

commit 241c927e5b5ad5a8e7264b2e21072aa1be6fc959
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Jun 22 00:20:52 2020 -0700

    try to get measurement changes propagated bottom up
---
 .../MXRoyale/src/main/royale/mx/core/Container.as  | 25 +++++++++++++++++++++-
 .../src/main/royale/mx/core/UIComponent.as         |  4 +++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index bc50368..c4137fe 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -35,6 +35,7 @@ package mx.core
     import org.apache.royale.core.IMXMLDocument;
     import org.apache.royale.core.IParent;
     import org.apache.royale.core.IStatesImpl;
+    import org.apache.royale.core.IUIBase;
     import org.apache.royale.core.ValuesManager;
     import org.apache.royale.core.layout.EdgeData;
     import org.apache.royale.events.Event;
@@ -98,8 +99,8 @@ import mx.styles.ISimpleStyleClient;
 import mx.styles.IStyleClient;
 import mx.styles.StyleProtoChain;
 
-use namespace mx_internal;
 */
+use namespace mx_internal;
 
 //--------------------------------------
 //  Events
@@ -877,6 +878,28 @@ public class Container extends UIComponent
 		dispatchEvent( new Event("layoutNeeded") );
 	}
 	
+    /**
+     *  @private
+     */
+    override mx_internal function childAdded(child:IUIBase):void
+    {
+		super.addingChild(child);
+		if (parent)
+		{
+			var oldMeasuredWidth:Number = measuredWidth;
+			var oldMeasuredHeight:Number = measuredHeight;
+			invalidateSize();
+			if (oldMeasuredWidth != measuredWidth ||
+				oldMeasuredHeight != measuredHeight)
+			{
+				if (parent is UIComponent)
+				{
+					(parent as UIComponent).invalidateSize();
+				}
+			}
+		}
+	}
+
 	
 	//----------------------------------
 	//  data
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 36fc392..4ce8444 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -3893,7 +3893,7 @@ COMPILE::JS
 		_measuredWidth = NaN;
 		_measuredHeight = NaN;
         if (parent)
-            (parent as IEventDispatcher).dispatchEvent(new Event("layoutNeeded")); // might cause too many layouts
+            dispatchEvent(new Event("layoutNeeded")); // might cause too many layouts
     }
 
     /**
@@ -5040,6 +5040,8 @@ COMPILE::JS
      */
     public function setActualSize(w:Number, h:Number):void
     {
+    
+    //    trace("setActualSize not implemented");
 		this.setWidthAndHeight(w, h);
     }