表格:背景/边框/冻结容器的 rect 每次更新都按尺寸钉回左上角

认领回来的旧生成物(_TableBackground / _TableBorders / 冻结容器)可能还带着上一版的
中心锚点,而 UpdateBackground 只改 sizeDelta、边框的认领路径干脆不改 rect——于是渲染器
以自己的局部原点(pivot 0.5)为左上角画出去,画面就是"以父组件中心为左上角"的错位。

新增 PinTopLeftRect:锚点/pivot 钉 (0,1)、锚位按参数、尺寸按总宽高,只在值不同时写。
背景每次 UpdateBackground、边框认领与刷新、冻结容器每次同步都走它。
This commit is contained in:
2026-11-17 14:59:52 +08:00
parent e4a70d0188
commit 22ef2174da
4 changed files with 39 additions and 5 deletions
@@ -218,8 +218,9 @@ namespace XericUI.XTable.Rendering.Component
// 冻结容器属于预制体:用驱动属性写入,编辑期不会把布局记成预制体修改。
m_LayoutDriven.Add(this, container,
DrivenTransformProperties.AnchoredPosition | DrivenTransformProperties.SizeDelta);
container.anchoredPosition = position + new Vector2(m_ContentOffset, -m_ContentOffset);
container.sizeDelta = new Vector2(m_TotalWidth + pad, m_TotalHeight + pad);
// 锚点/锚位也钉死:认领回来的旧容器可能还带着上一版的中心锚点。
PinTopLeftRect(container, position + new Vector2(m_ContentOffset, -m_ContentOffset),
m_TotalWidth + pad, m_TotalHeight + pad);
}
}
}