I have a typical scroll view layout. I populate the grid dynamically at runtime.
On my draggable panel I have Disable Drag If Fits turned on.
When I fill my grid and it does fit then I cannot scroll just like I want. And when I fill my grid with more item then it can show, I can drag my panel.
But when I first load a lot of items scroll through the list and then repopulate the grid with a few items so that it fits in the panel I can still drag until I release my first drag.
This is what happens on populate:
//Clear current items.
ClearGrid();
yield return new WaitForEndOfFrame
();
foreach (UserLevelInfo levelInfo in _userLevelItems.Where(predicate))
{
GameObject go = Instantiate(UserLevelItemPrefab) as GameObject;
Transform itemTrans = item.transform;
itemTrans.parent = _gridTransform;
itemTrans.localScale = Vector3.one;
itemTrans.localPosition = Vector3.zero;
}
//Reposition the grid elements.
GridList.Reposition();
yield return new WaitForEndOfFrame
();
//Recalculate clipping.
_dragPanel.ResetPosition();
I have tried to mess with SetDragAmount, but didn't help.
The problem only happens when I have scrolled before I repopulate the grid to fewer items.
Does anyone have a suggestion?