UnityEditor.DopeSheetEditorRectangleTool.CalculateLayout C# (CSharp) Method

CalculateLayout() private method

private CalculateLayout ( ) : ToolLayout
return ToolLayout
        private ToolLayout CalculateLayout()
        {
            ToolLayout layout = new ToolLayout();
            Bounds selectionBounds = this.selectionBounds;
            bool flag = !Mathf.Approximately(selectionBounds.size.x, 0f);
            float x = base.TimeToPixel(selectionBounds.min.x);
            float num2 = base.TimeToPixel(selectionBounds.max.x);
            float y = 0f;
            float num4 = 0f;
            bool flag2 = true;
            float num5 = 0f;
            List<DopeLine> dopelines = this.m_State.dopelines;
            for (int i = 0; i < dopelines.Count; i++)
            {
                DopeLine line = dopelines[i];
                float num7 = !line.tallMode ? 16f : 32f;
                if (!line.isMasterDopeline)
                {
                    int count = line.keys.Count;
                    for (int j = 0; j < count; j++)
                    {
                        AnimationWindowKeyframe keyframe = line.keys[j];
                        if (this.m_State.KeyIsSelected(keyframe))
                        {
                            if (flag2)
                            {
                                y = num5;
                                flag2 = false;
                            }
                            num4 = num5 + num7;
                            break;
                        }
                    }
                }
                num5 += num7;
            }
            layout.summaryRect = new Rect(x, 0f, num2 - x, 16f);
            layout.selectionRect = new Rect(x, y, num2 - x, num4 - y);
            if (flag)
            {
                layout.scaleLeftRect = new Rect(layout.selectionRect.xMin - 17f, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
                layout.scaleRightRect = new Rect(layout.selectionRect.xMax, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
            }
            else
            {
                layout.scaleLeftRect = g_EmptyRect;
                layout.scaleRightRect = g_EmptyRect;
            }
            if (flag)
            {
                layout.leftLabelAnchor = new Vector2(layout.summaryRect.xMin - 8f, base.contentRect.yMin + 1f);
                layout.rightLabelAnchor = new Vector2(layout.summaryRect.xMax + 8f, base.contentRect.yMin + 1f);
                return layout;
            }
            layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.summaryRect.center.x + 8f, base.contentRect.yMin + 1f);
            return layout;
        }