summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b5878d7)
When using GridLayout view with ScrollableBase, it cannot be scrolled.
It cauesd by wrong height measurement and it only happend when setting
WrapContent to layout view.
Save measurement result when using WrapContent.
Co-authored-by: krown <neostom432@nate.com>
private void ScrollBy(float displacement, bool animate)
{
private void ScrollBy(float displacement, bool animate)
{
- if (GetChildCount() == 0 || displacement == 0)
+ if (GetChildCount() == 0 || displacement == 0 || maxScrollDistance < 0)
- // Grid expands to fit content
+ // Grid expands to fit content
- // If number of columns AUTO_FIT then set to 1 column.
- _columns = ( _columns > 0 ) ? _columns : 1;
- // Calculate numbers of rows, round down result as later check for remainder.
- _rows = childCount / _columns;
- // If number of cells not cleanly dividable by columns, add another row to house remainder cells.
- _rows += ( childCount % _columns > 0 ) ? 1 : 0;
+ // If number of columns AUTO_FIT then set to 1 column.
+ _columns = ( _columns > 0 ) ? _columns : 1;
+ // Calculate numbers of rows, round down result as later check for remainder.
+ _rows = childCount / _columns;
+ // If number of cells not cleanly dividable by columns, add another row to house remainder cells.
+ _rows += ( childCount % _columns > 0 ) ? 1 : 0;
- availableContentHeight = desiredChildHeight * _rows;
+ heightSize = desiredChildHeight * _rows + gridLayoutPadding.Top + gridLayoutPadding.Bottom;
+ availableContentHeight = heightSize - gridLayoutPadding.Top - gridLayoutPadding.Bottom;
- // If number of columns not defined
- DetermineNumberOfColumns( availableContentWidth );
+ // If number of columns not defined
+ DetermineNumberOfColumns( availableContentWidth );
- // Locations define the start, end,top and bottom of each cell.
- _locations.CalculateLocations(_columns, availableContentWidth, availableContentHeight, childCount);
+ // Locations define the start, end,top and bottom of each cell.
+ _locations.CalculateLocations(_columns, availableContentWidth, availableContentHeight, childCount);