冻结行列添加偏移量与表格对齐

This commit is contained in:
2026-08-18 15:17:21 +08:00
parent 49b4fab1ca
commit b534795dcf
@@ -211,8 +211,11 @@ namespace XericUI.XTable.Rendering.Component
private void SyncFrozenContainer(RectTransform container, Vector2 position)
{
if (container == null) return;
container.anchoredPosition = position;
container.sizeDelta = new Vector2(m_TotalWidth, m_TotalHeight);
// 偏移 m_ContentOffset(边框半宽)以对齐 Content 中单元格的偏移,
// 避免冻结区域左侧/顶部的 1px 边框因 0.5px 坐标差被 viewport 裁切。
float pad = m_ContentOffset * 2f;
container.anchoredPosition = position + new Vector2(m_ContentOffset, -m_ContentOffset);
container.sizeDelta = new Vector2(m_TotalWidth + pad, m_TotalHeight + pad);
}
}
}