From 212d9a4d5e73c1fc0ff4f6bac615cd315d46df4c Mon Sep 17 00:00:00 2001 From: Sinai <49360850+sinai-dev@users.noreply.github.com> Date: Thu, 22 Apr 2021 21:18:31 +1000 Subject: [PATCH] Fix Take from sister cache --- src/UI/Widgets/ScrollPool/DataHeightCache.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/UI/Widgets/ScrollPool/DataHeightCache.cs b/src/UI/Widgets/ScrollPool/DataHeightCache.cs index ecce5de..e8e96ec 100644 --- a/src/UI/Widgets/ScrollPool/DataHeightCache.cs +++ b/src/UI/Widgets/ScrollPool/DataHeightCache.cs @@ -29,7 +29,7 @@ namespace UnityExplorer.UI.Widgets this.sisterCache = sisterCache; ExplorerCore.Log("Creating backup height cache, this count: " + scrollPool.DataSource.ItemCount); - AddRange(sisterCache.Take(scrollPool.DataSource.ItemCount)); + TakeFromSister(scrollPool.DataSource.ItemCount); } private readonly List heightCache = new List(); @@ -77,9 +77,10 @@ namespace UnityExplorer.UI.Widgets Add(entry); } - public IEnumerable Take(int count) + public void TakeFromSister(int count) { - return heightCache.Take(count); + for (int i = 0, i < count; i++) + Add(sisterCache[ScrollPool.DataSource.GetRealIndexForTempIndex(i)]); } public void RemoveLast()