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 2018/08/13 19:02:42 UTC

[royale-asjs] 03/09: handle explicit width and height

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

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

commit 205e691f8126f05b18c568173ce9ceea8cc341a8
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Aug 13 11:41:20 2018 -0700

    handle explicit width and height
---
 .../main/royale/org/apache/royale/core/ImageViewBase.as    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
index d7fb687..28191ef 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
@@ -250,8 +250,13 @@ package org.apache.royale.core
             var rs:String = s.right;
             if (typeof(rs) === 'string' && rs.length > 0)
                 r = parseFloat(rs.substring(0, rs.length - 2));
+            var w:Number = NaN;
+            var ws:String = s.width;
+            if (typeof(ws) === 'string' && ws.length > 0)
+                w = parseFloat(ws.substring(0, ws.length - 2));
             if (!isNaN(l) &&
-                !isNaN(r)) {
+                !isNaN(r) && 
+                !isNaN(w)) {
                 // if just using size constraints and image will not shrink or grow
                 var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
                     l - r;
@@ -265,8 +270,13 @@ package org.apache.royale.core
             var bs:String = s.right;
             if (typeof(bs) === 'string' && bs.length > 0)
                 b = parseFloat(bs.substring(0, bs.length - 2));
+            var h:Number = NaN;
+            var hs:String = s.height;
+            if (typeof(hs) === 'string' && hs.length > 0)
+                h = parseFloat(hs.substring(0, hs.length - 2));
             if (!isNaN(t) &&
-                !isNaN(b)) {
+                !isNaN(b) &&
+                !isNaN(h)) {
                 // if just using size constraints and image will not shrink or grow
                 var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
                     t - b;