From 59156492e7de9f1a1e98320f43021e66f92dd648 Mon Sep 17 00:00:00 2001 From: Sinai Date: Sat, 24 Apr 2021 04:01:30 +1000 Subject: [PATCH] Add jump to top logic for rebuild and refresh --- src/UI/Widgets/ScrollPool/ScrollPool.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/UI/Widgets/ScrollPool/ScrollPool.cs b/src/UI/Widgets/ScrollPool/ScrollPool.cs index a223474..b18fb69 100644 --- a/src/UI/Widgets/ScrollPool/ScrollPool.cs +++ b/src/UI/Widgets/ScrollPool/ScrollPool.cs @@ -107,6 +107,17 @@ namespace UnityExplorer.UI.Widgets public void Rebuild() { 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() @@ -595,7 +606,7 @@ namespace UnityExplorer.UI.Widgets bottomDataIndex = poolStartIndex + CellPool.Count - 1; RefreshCells(true, false); - //UpdateSliderHandle(true); + UpdateSliderHandle(true); } /// Use