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/25 06:33:26 UTC

[royale-asjs] 02/03: fix scroller viewport sizing

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

commit 735f72a5c862a614531534c3f8f81273d68e0c0f
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Mar 24 23:32:33 2020 -0700

    fix scroller viewport sizing
---
 .../src/main/royale/spark/components/Scroller.as         | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Scroller.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Scroller.as
index fe6b416..a98c114 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Scroller.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Scroller.as
@@ -71,7 +71,7 @@ import spark.components.supportClasses.SkinnableComponent;
 import spark.core.IViewport;
 
 import org.apache.royale.core.IChild;
-import org.apache.royale.events.Event;
+import org.apache.royale.events.Event;
 
 use namespace mx_internal;
 /* 
@@ -3890,16 +3890,22 @@ public class Scroller extends SkinnableComponent
     override public function addedToParent():void
     {
         super.addedToParent();
-        (_viewport as UIComponent).width = width;
-        (_viewport as UIComponent).height = height;
+		var vp:UIComponent = _viewport as UIComponent;
+		if (vp.isWidthSizedToContent())
+        		vp.setWidth(width);
+		if (vp.isHeightSizedToContent())
+        		vp.setHeight(height);
         installViewport();
     }
     
     override public function setActualSize(w:Number, h:Number):void
     {
         super.setActualSize(w, h);
-        (_viewport as UIComponent).width = width;
-        (_viewport as UIComponent).height = height;        
+		var vp:UIComponent = _viewport as UIComponent;
+		if (vp.isWidthSizedToContent())
+        		vp.setWidth(width);
+		if (vp.isHeightSizedToContent())
+        		vp.setHeight(height);
     }
 }