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/03/21 05:33:38 UTC
[royale-asjs] branch develop updated: CanvasLayout should size
things with percentages. Someday handle overloading percentages
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 bab3f15 CanvasLayout should size things with percentages. Someday handle overloading percentages
bab3f15 is described below
commit bab3f15f93c132b79d40df8987d39fe423040877
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Mar 20 22:33:17 2020 -0700
CanvasLayout should size things with percentages. Someday handle overloading percentages
---
.../main/royale/mx/containers/beads/CanvasLayout.as | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
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 7cc8672..48622cf 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
@@ -212,7 +212,23 @@ public class CanvasLayout extends LayoutBase
for (i=0; i < n; i++) {
var child:IUIComponent = target.getLayoutChildAt(i);
child.positioner.style.position = "absolute";
- child.dispatchEvent(new Event("layoutNeeded"));
+ var layoutNeeded:Boolean = true;
+ var hh:Number = child.height;
+ if (!isNaN(child.percentHeight))
+ {
+ hh = target.height * child.percentHeight / 100;
+ layoutNeeded = false;
+ }
+ var ww:Number = child.width;
+ if (!isNaN(child.percentWidth))
+ {
+ ww = target.width * child.percentWidth / 100;
+ layoutNeeded = false;
+ }
+ if (layoutNeeded)
+ child.dispatchEvent(new Event("layoutNeeded"));
+ else
+ child.setActualSize(ww, hh);
}
return true;