summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-27 17:01:41 +0800
committerchai <chaifix@163.com>2021-04-27 17:01:41 +0800
commitc3979444c23fb831ebd2be4ec8829b691ee71474 (patch)
treee505858a049ccf895f2e5ef906c88f1fc3f33e5b /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout
parent83eb6c0dc5773c40b5ee4d9b2fb1d72a7d5294f5 (diff)
*layout
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout')
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs9
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs3
2 files changed, 8 insertions, 4 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs
index 59d432c..6a17e00 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs
@@ -34,12 +34,13 @@ namespace UnityEngine.UI
private Vector2 m_TotalFlexibleSize = Vector2.zero;
[System.NonSerialized] private List<RectTransform> m_RectChildren = new List<RectTransform>();
- protected List<RectTransform> rectChildren { get { return m_RectChildren; } }
-
- // ILayoutElement Interface
+ protected List<RectTransform> rectChildren { get { return m_RectChildren; } }
+
+
+ // ILayoutElement Interface
+ // 收集子节点中参与布局的节点
public virtual void CalculateLayoutInputHorizontal()
{
- // 收集子节点中参与layout的节点
m_RectChildren.Clear();
var toIgnoreList = ListPool<Component>.Get();
for (int i = 0; i < rectTransform.childCount; i++)
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
index 6edd5b5..5fba1cc 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs
@@ -78,6 +78,7 @@ namespace UnityEngine.UI
}
}
+ // 从上到下遍历,执行action
private void PerformLayoutControl(RectTransform rect, UnityAction<Component> action)
{
if (rect == null)
@@ -96,6 +97,8 @@ namespace UnityEngine.UI
// Layout control needs to executed top down with parents being done before their children,
// because the children rely on the sizes of the parents.
+ // 做两次遍历,先执行ILayoutSelfController比如ContentSizeFitter,再执行ILayoutGroup
+
// First call layout controllers that may change their own RectTransform
for (int i = 0; i < components.Count; i++)
if (components[i] is ILayoutSelfController)