From e597980b4e391a778c67a1934a388ee3dc7c765b Mon Sep 17 00:00:00 2001 From: neostom432 <31119276+neostom432@users.noreply.github.com> Date: Mon, 20 Jan 2020 16:14:57 +0900 Subject: [PATCH 1/1] [NUI] Fixed GridLayout scrolling issue (#1322) 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 --- .../Controls/ScrollableBase.cs | 2 +- src/Tizen.NUI/src/public/Layouting/GridLayout.cs | 25 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index 1e29196..1e64db7 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -423,7 +423,7 @@ namespace Tizen.NUI.Components private void ScrollBy(float displacement, bool animate) { - if (GetChildCount() == 0 || displacement == 0) + if (GetChildCount() == 0 || displacement == 0 || maxScrollDistance < 0) { return; } diff --git a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs index 8d0cd51..fe1729d 100755 --- a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs @@ -183,23 +183,24 @@ namespace Tizen.NUI } else { - // 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); } // Children exists -- 2.7.4