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

yishayw 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 8ed6aa9  Implement horizontalCenter on canvas elements
     new 9dd7e1e  Merge branch 'develop' of 
https://gitbox.apache.org/repos/asf/royale-asjs into develop
8ed6aa9 is described below

commit 8ed6aa99dc59223045e72643950eb8122bb029a5
Author: DESKTOP-RH4S838\Yishay <yishayj...@hotmail.com>
AuthorDate: Wed Apr 22 18:06:29 2020 +0300

    Implement horizontalCenter on canvas elements
---
 .../MXRoyale/src/main/royale/mx/containers/beads/CanvasLayout.as   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/CanvasLayout.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/CanvasLayout.as
index 48622cf..aeab418 100644
--- 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/CanvasLayout.as
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/CanvasLayout.as
@@ -25,6 +25,7 @@ package mx.containers.beads
        import mx.core.IUIComponent;
        
        import org.apache.royale.core.IStrand;
+       import mx.core.ILayoutElement;
        import org.apache.royale.core.LayoutBase;
        import org.apache.royale.events.Event;
        import org.apache.royale.geom.Rectangle;
@@ -211,6 +212,7 @@ public class CanvasLayout extends LayoutBase
                        // each child must have position:absolute for 
BasicLayout to work
                        for (i=0; i < n; i++) {
                                var child:IUIComponent = 
target.getLayoutChildAt(i);
+                               var hCenter:Number = Number((child as 
ILayoutElement).horizontalCenter);
                                child.positioner.style.position = "absolute";
                                var layoutNeeded:Boolean = true;
                                var hh:Number = child.height;
@@ -225,6 +227,11 @@ public class CanvasLayout extends LayoutBase
                                        ww = target.width * child.percentWidth 
/ 100;
                                        layoutNeeded = false;
                                }
+                               if (!isNaN(hCenter))
+                               {
+                                       // TODO consider how this affects 
measurement of target
+                                       child.x = Math.round((target.width - 
ww) / 2 + hCenter);
+                               }
                                if (layoutNeeded)
                        child.dispatchEvent(new Event("layoutNeeded"));
                                else

Reply via email to