Add jump to top logic for rebuild and refresh

This commit is contained in:
Sinai 2021-04-24 04:01:30 +10:00
parent ebb89b1b8b
commit 59156492e7

View File

@ -107,6 +107,17 @@ namespace UnityExplorer.UI.Widgets
public void Rebuild() public void Rebuild()
{ {
RecreateCellPool(true, true, null); RecreateCellPool(true, true, null);
writingLocked = false;
Content.anchoredPosition = Vector2.zero;
UpdateSliderHandle(true);
}
public void RefreshAndJumpToTop()
{
bottomDataIndex = CellPool.Count - 1;
RefreshCells(true);
Content.anchoredPosition = Vector2.zero;
UpdateSliderHandle(true);
} }
public void EnableTempCache() public void EnableTempCache()
@ -595,7 +606,7 @@ namespace UnityExplorer.UI.Widgets
bottomDataIndex = poolStartIndex + CellPool.Count - 1; bottomDataIndex = poolStartIndex + CellPool.Count - 1;
RefreshCells(true, false); RefreshCells(true, false);
//UpdateSliderHandle(true); UpdateSliderHandle(true);
} }
/// <summary>Use <see cref="UIFactory.CreateScrollPool"/></summary> /// <summary>Use <see cref="UIFactory.CreateScrollPool"/></summary>