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/08/07 23:40:53 UTC

[royale-asjs] branch divided updated: Some nore changes to emulate DividedBox

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

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


The following commit(s) were added to refs/heads/divided by this push:
     new b91da0b  Some nore changes to emulate DividedBox
b91da0b is described below

commit b91da0b4f7c0f6b2f2604111426f9022e3becc48
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Sun Aug 8 02:36:34 2021 +0300

    Some nore changes to emulate DividedBox
    
    Make sure DividedBox.updateDisplayList() is triggered, workaround mx namespace bug, cheat to try to make separator layer chrome-like.
---
 .../src/main/royale/mx/containers/DividedBox.as    | 27 ++++++++++++++++++----
 .../royale/mx/containers/beads/DividedBoxLayout.as |  7 +++---
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/DividedBox.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/DividedBox.as
index 2a410c7..34832a0 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/DividedBox.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/DividedBox.as
@@ -663,6 +663,8 @@ public class DividedBox extends Box
 	override protected function updateDisplayList(unscaledWidth:Number,
 												  unscaledHeight:Number):void
 	{
+		dividerLayer.width = unscaledWidth;
+		dividerLayer.height = unscaledHeight;
  		var n:int;
  		var i:int;
 
@@ -825,12 +827,27 @@ public class DividedBox extends Box
 	/**
 	 *  @private
 	 */
+	override public function invalidateDisplayList():void
+	{
+		super.invalidateDisplayList();
+		updateDisplayList(width, height);
+	}
+
+	override public function get numElements():int
+	{
+		return dividerLayer ? super.numElements - 1 : super.numElements;
+	}
+
+	/**
+	 *  @private
+	 */
 	private function createDivider(i:int):BoxDivider
 	{
 		// Create separate layer for holding divider objects.
 		if (!dividerLayer)
 		{
 			dividerLayer = UIComponent(rawChildren.addChild(new UIComponent()));
+			dividerLayer.setIncludeInLayout(false);
 		}
 
 		var divider:BoxDivider = BoxDivider(new dividerClass());
@@ -864,7 +881,7 @@ public class DividedBox extends Box
 		//
 		//divider.styleName = basedOn;
 		//
-		//divider.owner = this;
+		divider.owner = this;
 		
 		return divider;
 	}
@@ -895,7 +912,7 @@ public class DividedBox extends Box
 		    //8           4             6               6              6        
 		    //8           6             4               4              4
 
-		var divider:UIComponent = UIComponent(getDividerAt(i));
+		var divider:BoxDivider = BoxDivider(getDividerAt(i));
 
 		 var vm:EdgeMetrics = viewMetricsAndPadding;
 
@@ -1083,7 +1100,7 @@ public class DividedBox extends Box
 		
 			var sz:Number = vertical ? child.height : child.width;
 
-			var mx:Number = vertical ? child.maxHeight : child.maxWidth;
+			var myMx:Number = vertical ? child.maxHeight : child.maxWidth;
 			
 			var umn:Number = vertical ?
 							 child.explicitMinHeight :
@@ -1094,12 +1111,12 @@ public class DividedBox extends Box
 			
 			// Compute these for later use.
 			var dMin:Number = Math.max(0, sz - mn);
-			var dMax:Number = Math.max(0, mx - sz);
+			var dMax:Number = Math.max(0, myMx - sz);
 
 			if (sz > 0 && sz < smallest)
 				smallest = sz;
 
-			oldChildSizes.push(new ChildSizeInfo(sz, mn, mx, dMin, dMax));
+			oldChildSizes.push(new ChildSizeInfo(sz, mn, myMx, dMin, dMax));
 		}
 
 		// Remember the smallest child size we saw.
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/DividedBoxLayout.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/DividedBoxLayout.as
index 6f9f93a..b2c86ee 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/DividedBoxLayout.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/DividedBoxLayout.as
@@ -94,9 +94,10 @@ package mx.containers.beads
 		
 		override public function layout():Boolean
 		{
-            preLayoutAdjustment();
-            return super.layout();
-            postLayoutAdjustment();
+			target.invalidateDisplayList(); // trigger synchronous updateDisplayList() TODO - consider moving everything to layout
+			preLayoutAdjustment();
+			return super.layout();
+			postLayoutAdjustment();
 		}
         
         /**