cristallium commented on issue #1193:
URL: https://github.com/apache/royale-asjs/issues/1193#issuecomment-1100650217
I dig a little more.
This is a little more complex than I thought .
I thing about 2 options :
Option 1) Assuming host has `scroll `classname then we could reserve
scrollbar width, the fix could be this one :
```
var adjustedHostWidth:Number = Math.floor(host.width - borderMetrics.left -
borderMetrics.right);
if (hostComponent.containsClass("scroll") == true){
adjustedHostWidth -= 16; // assuming 16px, I don't know how to get
scrollbar width
}
```
Option 2) We need to check if total height is greater than host height. The
fix could be (to be paste just before loop throught childs to set styles) :
```
if (hostComponent.containsClass("scroll") == true){
// Compute total needed height to know if we will trigger vertical
scrollbar
var totalNeededHeight:Number = _rowCount * ( useHeight + _verticalGap);
trace ("TotalNeededHeight:" + totalNeededHeight);
if (totalNeededHeight > adjustedHostHeight){
trace("Trigger VScrollbar");
adjustedHostWidth -= 16; //take scrollbarsize into account
(works only with 16px wide)
if (needWidth)
{
// calculate columnCount based of the widesTile
_columnCount = _requestedColumnCount != -1 ?
_requestedColumnCount : Math.floor(adjustedHostWidth / (widestTile +
_horizontalGap));
useWidth = _requestedColumnCount == -1 ? widestTile :
Math.floor((adjustedHostWidth - _horizontalGap) / _columnCount);
} else {
// calculate columnCount based on columnWidth
_columnCount = _requestedColumnCount != -1 ?
_requestedColumnCount : Math.floor(adjustedHostWidth/ (_columnWidth +
_horizontalGap));
useWidth = _requestedColumnCount == -1 ? _columnWidth :
Math.floor((adjustedHostWidth - _horizontalGap) / _columnCount);
}
}else{
trace("No VScrollbar");
}
}
```
The issue with Option 2, is that we need to call again updateLayout() in
case of browser height resize. (I tried it and updateLayout wasn't called)
Here are the files for 2 options.
Option 1
[TileHorizontalLayout -
Option1.txt](https://github.com/apache/royale-asjs/files/8499860/TileHorizontalLayout.-.Option1.txt)
Option 2
[TileHorizontalLayout -
Option2.txt](https://github.com/apache/royale-asjs/files/8499861/TileHorizontalLayout.-.Option2.txt)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]