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

commit bd3c5f3bf33090aaa872407f9887fadb8eb398d8
Author: Carlos Rovira <carlos.rov...@apache.org>
AuthorDate: Thu Jun 4 00:32:25 2020 +0200

    jewel-tilelayout: fix final issues
---
 .../org/apache/royale/jewel/beads/layouts/TileLayout.as       | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileLayout.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileLayout.as
index a6ebf2e..0df34e0 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileLayout.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileLayout.as
@@ -441,10 +441,10 @@ package org.apache.royale.jewel.beads.layouts
                                        {
                                                // calculate columnCount in 
base of the widesTile
                                                _columnCount = 
_requestedColumnCount != -1 ? _requestedColumnCount : 
Math.floor(adjustedHostWidth / (widestTile + horizontalGap));
-                                               useWidth = 
_requestedColumnCount == -1 ? widestTile : Math.floor((adjustedHostWidth + 
horizontalGap)/ columnCount);
+                                               useWidth = 
_requestedColumnCount == -1 ? widestTile : Math.floor((adjustedHostWidth - 
horizontalGap) / columnCount);
                                        } else {
                                                _columnCount = 
_requestedColumnCount != -1 ? _requestedColumnCount : 
Math.floor(adjustedHostWidth/ (_columnWidth + horizontalGap));
-                                               useWidth = 
_requestedColumnCount == -1 ? _columnWidth : Math.floor((adjustedHostWidth + 
horizontalGap)/ columnCount);
+                                               useWidth = 
_requestedColumnCount == -1 ? _columnWidth : Math.floor((adjustedHostWidth - 
horizontalGap) / columnCount);
                                        }
                                        trace("  -- _columnCount", 
_columnCount);
                                        trace("  -- useWidth", useWidth);
@@ -498,6 +498,13 @@ package org.apache.royale.jewel.beads.layouts
                                                child.width = 
_requestedColumnCount == -1 ? useWidth : useWidth - horizontalGap;
                                        if(useHeight > 0)
                                                child.height = 
_requestedRowCount == -1 ? useHeight : useHeight - verticalGap;
+                                       
+                                       // avoid a tile from the next row stay 
in the previous row due to flexbox algorithm
+                                       if(i % columnCount == columnCount - 1)
+                                               
child.positioner.style.marginRight = Math.floor(adjustedHostWidth - (1 + 
child.width + (child.width + horizontalGap) * (_columnCount - 1))) + "px";
+                                       else
+                                               
child.positioner.style.marginRight = null;
+                                       
                                        child.dispatchEvent('sizeChanged');
                                }
                                return true;

Reply via email to