You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/06/24 22:08:47 UTC
[royale-asjs] branch develop updated: jewel-layouts: fix a bug in
waitForSize that was causing the layout not run when waitForSize is
activated
This is an automated email from the ASF dual-hosted git repository.
carlosrovira 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 3795de5 jewel-layouts: fix a bug in waitForSize that was causing the layout not run when waitForSize is activated
3795de5 is described below
commit 3795de5f29b03353d76d0e02923237782f7b0011
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Jun 25 00:08:35 2020 +0200
jewel-layouts: fix a bug in waitForSize that was causing the layout not run when waitForSize is activated
---
.../main/royale/org/apache/royale/core/BrowserResizeListener.as | 2 +-
.../Basic/src/main/royale/org/apache/royale/core/StyledUIBase.as | 4 ++--
.../Core/src/main/royale/org/apache/royale/core/LayoutBase.as | 7 +++----
.../org/apache/royale/jewel/beads/layouts/StyledLayoutBase.as | 9 +--------
4 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/BrowserResizeListener.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
index 632fa69..9a49c90 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
@@ -63,7 +63,7 @@ package org.apache.royale.core
}
COMPILE::JS
{
- window.addEventListener('resize', this.resizeHandler, false);
+ window.addEventListener('resize', resizeHandler, false);
}
}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledUIBase.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledUIBase.as
index a375c4b..f6578ed 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledUIBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledUIBase.as
@@ -334,7 +334,7 @@ package org.apache.royale.core
_width = newWidth;
COMPILE::JS
{
- this.positioner.style.width = isNaN(newWidth) ? null : newWidth.toString() + 'px';
+ this.positioner.style.width = isNaN(newWidth) ? null : newWidth.toString() + 'px';
}
if (!noEvent && !heightChanged)
sendEvent(this, "widthChanged");
@@ -344,7 +344,7 @@ package org.apache.royale.core
_height = newHeight;
COMPILE::JS
{
- this.positioner.style.height = isNaN(newHeight) ? null : newHeight.toString() + 'px';
+ this.positioner.style.height = isNaN(newHeight) ? null : newHeight.toString() + 'px';
}
if (!noEvent && !widthChanged)
sendEvent(this, "heightChanged");
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
index 26c8e10..1dcc0bb 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
@@ -86,10 +86,9 @@ package org.apache.royale.core
{
_strand = value;
host = value as ILayoutChild;
- var sizeChange:Function = handleSizeChange;
- listenOnStrand("widthChanged", sizeChange);
- listenOnStrand("heightChanged", sizeChange);
- listenOnStrand("sizeChanged", sizeChange);
+ listenOnStrand("widthChanged", handleSizeChange);
+ listenOnStrand("heightChanged", handleSizeChange);
+ listenOnStrand("sizeChanged", handleSizeChange);
listenOnStrand("childrenAdded", handleChildrenAdded);
listenOnStrand("initComplete", handleInitComplete);
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/StyledLayoutBase.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/StyledLayoutBase.as
index e25b588..4d74268 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/StyledLayoutBase.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/StyledLayoutBase.as
@@ -261,24 +261,17 @@ package org.apache.royale.jewel.beads.layouts
public var waitForSize:Boolean = false;
/**
- * If waitForSize is true, sizeInitialized will be true when host get size.
- */
- COMPILE::JS
- protected var sizeInitialized:Boolean = false;
-
- /**
* We call requestAnimationFrame until we get width and height
*/
COMPILE::JS
protected function checkHostSize():void {
- if(sizeInitialized) return;
if((host.width == 0 && !isNaN(host.percentWidth)) ||
(host.height == 0 && !isNaN(host.percentHeight)))
{
requestAnimationFrame(checkHostSize);
} else
{
- sizeInitialized = true;
+ waitForSize = false;
executeLayout();
}
}