private void UpdateRect()
{
if (this.IsActive())
{
this.m_Tracker.Clear();
switch (this.m_AspectMode)
{
case AspectMode.None:
if (!Application.isPlaying)
{
this.m_AspectRatio = Mathf.Clamp((float) (this.rectTransform.rect.width / this.rectTransform.rect.height), (float) 0.001f, (float) 1000f);
}
break;
case AspectMode.WidthControlsHeight:
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDeltaY);
this.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, this.rectTransform.rect.width / this.m_AspectRatio);
break;
case AspectMode.HeightControlsWidth:
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDeltaX);
this.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, this.rectTransform.rect.height * this.m_AspectRatio);
break;
case AspectMode.FitInParent:
case AspectMode.EnvelopeParent:
{
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDelta | DrivenTransformProperties.Anchors | DrivenTransformProperties.AnchoredPosition);
this.rectTransform.anchorMin = Vector2.zero;
this.rectTransform.anchorMax = Vector2.one;
this.rectTransform.anchoredPosition = Vector2.zero;
Vector2 zero = Vector2.zero;
Vector2 parentSize = this.GetParentSize();
if (!(((parentSize.y * this.aspectRatio) < parentSize.x) ^ (this.m_AspectMode == AspectMode.FitInParent)))
{
zero.x = this.GetSizeDeltaToProduceSize(parentSize.y * this.aspectRatio, 0);
}
else
{
zero.y = this.GetSizeDeltaToProduceSize(parentSize.x / this.aspectRatio, 1);
}
this.rectTransform.sizeDelta = zero;
return;
}
}
}
}