修复表格在做成预制体的情况下,且存在冻结单元格的时候,冻结单元格的内容复用会出现冻结在原地的情况

This commit is contained in:
2026-08-03 17:50:10 +08:00
parent 29c7c4e81e
commit 1b9778abe6
2 changed files with 18 additions and 6 deletions
@@ -177,7 +177,7 @@ namespace XericUI.XTable.Rendering.Component
{
if (string.IsNullOrEmpty(data.Text)) return;
var txt = m_Assembler.GetText(cellId, "cell_text", cellNS);
var txt = m_Assembler.GetText(cellId, "cell_text", cellNS, ContentTransform);
if (txt == null) return;
txt.Rect.anchoredPosition = new Vector2(cellX + CellPadding, cellY);
txt.Rect.sizeDelta = new Vector2(cellW - CellPadding2, cellH);
@@ -201,7 +201,7 @@ namespace XericUI.XTable.Rendering.Component
if (data.Image == null) return;
Sprite sprite = GetOrCreateSprite(data.Image);
var img = m_Assembler.GetImage(cellId, "cell_image", cellNS);
var img = m_Assembler.GetImage(cellId, "cell_image", cellNS, ContentTransform);
if (img == null) return;
img.Rect.anchoredPosition = new Vector2(cellX + CellPadding, cellY);
img.Rect.sizeDelta = new Vector2(cellW - CellPadding2, cellH);
@@ -183,9 +183,15 @@ namespace XericUI.XTable.Rendering.Elements
if (item != null) m_TextPool.ReleaseCell(item.CellId);
}
private static void SetImageCounterActive(IReadOnlyList<PooledImage> items)
private void SetImageCounterActive(IReadOnlyList<PooledImage> items)
{
for (int i = 0; i < items.Count; i++) items[i].Root.SetActive(true);
for (int i = 0; i < items.Count; i++)
{
// Counter 整体重新借出前清空历史 Slot 的视觉状态;未重新绑定的 Slot
// 即使随 Counter 激活,也不会保留冻结区域的旧内容。
ResetImageDefaults(items[i]);
items[i].Root.SetActive(true);
}
}
private static void SetImageCounterInactive(IReadOnlyList<PooledImage> items)
@@ -197,9 +203,15 @@ namespace XericUI.XTable.Rendering.Elements
}
}
private static void SetTextCounterActive(IReadOnlyList<PooledText> items)
private void SetTextCounterActive(IReadOnlyList<PooledText> items)
{
for (int i = 0; i < items.Count; i++) items[i].Root.SetActive(true);
for (int i = 0; i < items.Count; i++)
{
// Counter 整体重新借出前清空历史 Slot 的视觉状态;未重新绑定的 Slot
// 即使随 Counter 激活,也不会保留冻结区域的旧内容。
ResetTextDefaults(items[i]);
items[i].Root.SetActive(true);
}
}
private static void SetTextCounterInactive(IReadOnlyList<PooledText> items)