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/04/26 21:46:39 UTC

[royale-asjs] branch develop updated: better measurement and layout for MX Forms. Maybe this will finally fix #797

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 2e3cb96  better measurement and layout for MX Forms.  Maybe this will finally fix #797
2e3cb96 is described below

commit 2e3cb96907693b61d72025be6d91d745f895150b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Apr 26 14:45:48 2020 -0700

    better measurement and layout for MX Forms.  Maybe this will finally fix #797
---
 .../projects/MXRoyale/src/main/resources/defaults.css |  2 +-
 .../src/main/royale/mx/containers/FormItem.as         | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index c0c8494..97facdc 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -254,7 +254,7 @@ FormItem
 {
 	IBeadView: ClassReference("mx.containers.beads.FormItemView");
 	IContentView: ClassReference("mx.containers.beads.FormItemContainer");
-	indicatorGap: 0px;
+	indicatorGap: 14px;
 }
 
 containerBeads|FormItemContainer
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
index 2b36a11..cf62562 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
@@ -639,13 +639,20 @@ public class FormItem extends Container
     {
         super.measure();
         
+		// this flag is set to get the natural measurements of the children
+		// in the form item, instead of adding the label widths
+		if (inMeasureWithLabel) return;
+		
+		inMeasureWithLabel = true;
         if (direction == FormItemDirection.VERTICAL)
             measureVertical();
         else
             measureHorizontal();
+		inMeasureWithLabel = false;
     }
 
 	private var inMeasure:Boolean = false;
+	private var inMeasureWithLabel:Boolean = false;
 	
 	override public function get measuredWidth():Number
 	{
@@ -829,6 +836,8 @@ public class FormItem extends Container
         measuredHeight = preferredHeight;
     }
 
+	private var inUpdateDisplayList:Boolean = false;	
+	
     /**
      *  Responds to size changes by setting the positions and sizes
      *  of this container's children.
@@ -876,7 +885,9 @@ public class FormItem extends Container
                                                   unscaledHeight:Number):void
     {
         super.updateDisplayList(unscaledWidth, unscaledHeight);
-
+		if (inUpdateDisplayList) return;
+		
+		inUpdateDisplayList = true;
         if (direction == FormItemDirection.VERTICAL)
         {
             updateDisplayListVerticalChildren(unscaledWidth, unscaledHeight);
@@ -885,6 +896,7 @@ public class FormItem extends Container
         {
             updateDisplayListHorizontalChildren(unscaledWidth, unscaledHeight);
         }
+		inUpdateDisplayList = false;
                 
         // Position our label now that our children have been positioned.
         // Moving our children can affect the baselinePosition. (Bug 86725)
@@ -1514,7 +1526,10 @@ public class FormItem extends Container
     override public function setActualSize(w:Number, h:Number):void
     {
         super.setActualSize(w, h);
-        updateDisplayList(w, h);
+		if (verticalLayoutObject)
+			verticalLayoutObject.updateDisplayList(w, h);
+		else
+	        updateDisplayList(w, h);
     }
 
     /**