You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2021/02/05 08:18:45 UTC

[royale-asjs] branch ChildResize updated: Make sure SkinnableContainer is measured by skin if possible

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

yishayw 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 42dead6  Make sure SkinnableContainer is measured by skin if possible
42dead6 is described below

commit 42dead6b64ac6d6c14a2d767ea2c38478516c826
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Fri Feb 5 10:18:24 2021 +0200

    Make sure SkinnableContainer is measured by skin if possible
---
 .../royale/spark/components/SkinnableContainer.as  | 67 +++++++++++++---------
 1 file changed, 40 insertions(+), 27 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
index 2df0662..65c3d10 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
@@ -30,6 +30,7 @@ import mx.utils.BitFlagUtil;
 import spark.events.ElementExistenceEvent;
 */
 import mx.core.IUIComponent;
+import spark.components.supportClasses.Skin;
 import mx.core.IVisualElement;
 import mx.core.mx_internal;
 
@@ -988,35 +989,47 @@ public class SkinnableContainer extends SkinnableContainerBase implements IConta
             (isWidthSizedToContent() || !isNaN(explicitWidth)))
             dispatchEvent(new Event("layoutNeeded"));
     }
-    
-    override public function get measuredWidth():Number
-    {
-        if (isNaN(_measuredWidth))
-            measure();
-        if (isNaN(_measuredWidth))
-             return width;
-        return _measuredWidth;
-    }
-
-    override public function get measuredHeight():Number
-    {
-        if (isNaN(_measuredHeight))
-            measure();
-        if (isNaN(_measuredHeight))
-            return height;
-        return _measuredHeight;
-    }
 
 
-    /**
-     *  @private
-     */
-    override protected function measure():void
-    {
-            _layout.measure();
-            
-    }
-
+     override public function get measuredWidth():Number
+     {
+         if (isNaN(_measuredWidth))
+             measure();
+         if (isNaN(_measuredWidth))
+              return width;
+         return _measuredWidth;
+     }
+ 
+     override public function get measuredHeight():Number
+     {
+         if (isNaN(_measuredHeight))
+             measure();
+         if (isNaN(_measuredHeight))
+             return height;
+         return _measuredHeight;
+     }
+ 
+ 
+     /**
+      *  @private
+      */
+     override protected function measure():void
+     {
+	     if (_layout)
+	     {
+		_layout.measure();
+	     } else if (skin)
+	     {
+		     (skin as Skin).layout.measure();
+		     measuredWidth = (skin as Skin).measuredWidth;
+		     measuredHeight = (skin as Skin).measuredHeight;
+	     } else
+	     {
+		     super.measure();
+	     }
+     }
+ 
+    
     override protected function createChildren():void
     {
         super.createChildren();