private DopeSheetEditorRectangleTool.ToolLayout CalculateLayout() { DopeSheetEditorRectangleTool.ToolLayout result = default(DopeSheetEditorRectangleTool.ToolLayout); Bounds selectionBounds = this.selectionBounds; bool flag = !Mathf.Approximately(selectionBounds.size.x, 0f); float num = base.TimeToPixel(selectionBounds.min.x); float num2 = base.TimeToPixel(selectionBounds.max.x); float num3 = 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 dopeLine = dopelines[i]; float num6 = (!dopeLine.tallMode) ? 16f : 32f; if (!dopeLine.isMasterDopeline) { int count = dopeLine.keys.Count; for (int j = 0; j < count; j++) { AnimationWindowKeyframe keyframe = dopeLine.keys[j]; if (this.m_State.KeyIsSelected(keyframe)) { if (flag2) { num3 = num5; flag2 = false; } num4 = num5 + num6; break; } } } num5 += num6; } result.summaryRect = new Rect(num, 0f, num2 - num, 16f); result.selectionRect = new Rect(num, num3, num2 - num, num4 - num3); if (flag) { result.scaleLeftRect = new Rect(result.selectionRect.xMin - 17f, result.selectionRect.yMin + 4f, 17f, result.selectionRect.height - 8f); result.scaleRightRect = new Rect(result.selectionRect.xMax, result.selectionRect.yMin + 4f, 17f, result.selectionRect.height - 8f); } else { result.scaleLeftRect = DopeSheetEditorRectangleTool.g_EmptyRect; result.scaleRightRect = DopeSheetEditorRectangleTool.g_EmptyRect; } if (flag) { result.leftLabelAnchor = new Vector2(result.summaryRect.xMin - 8f, base.contentRect.yMin + 1f); result.rightLabelAnchor = new Vector2(result.summaryRect.xMax + 8f, base.contentRect.yMin + 1f); } else { result.leftLabelAnchor = (result.rightLabelAnchor = new Vector2(result.summaryRect.center.x + 8f, base.contentRect.yMin + 1f)); } return(result); }
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); }
private ToolLayout CalculateLayout() { ToolLayout layout = new ToolLayout(); Bounds bounds = selectionBounds; bool canScaleX = !Mathf.Approximately(bounds.size.x, 0f); float xMin = TimeToPixel(bounds.min.x); float xMax = TimeToPixel(bounds.max.x); float yMin = 0f, yMax = 0f; bool firstKey = true; float heightCumul = 0f; List <DopeLine> dopelines = m_State.dopelines; for (int i = 0; i < dopelines.Count; ++i) { DopeLine dopeline = dopelines[i]; float dopelineHeight = (dopeline.tallMode ? AnimationWindowHierarchyGUI.k_DopeSheetRowHeightTall : AnimationWindowHierarchyGUI.k_DopeSheetRowHeight); if (!dopeline.isMasterDopeline) { int length = dopeline.keys.Count; for (int j = 0; j < length; j++) { AnimationWindowKeyframe keyframe = dopeline.keys[j]; if (m_State.KeyIsSelected(keyframe)) { if (firstKey) { yMin = heightCumul; firstKey = false; } yMax = heightCumul + dopelineHeight; break; } } } heightCumul += dopelineHeight; } layout.summaryRect = new Rect(xMin, 0f, xMax - xMin, AnimationWindowHierarchyGUI.k_DopeSheetRowHeight); layout.selectionRect = new Rect(xMin, yMin, xMax - xMin, yMax - yMin); // Scale handles. if (canScaleX) { layout.scaleLeftRect = new Rect(layout.selectionRect.xMin - kScaleLeftMarginHorizontal - kScaleLeftWidth, layout.selectionRect.yMin + kScaleLeftMarginVertical, kScaleLeftWidth, layout.selectionRect.height - kScaleLeftMarginVertical * 2); layout.scaleRightRect = new Rect(layout.selectionRect.xMax + kScaleRightMarginHorizontal, layout.selectionRect.yMin + kScaleRightMarginVertical, kScaleRightWidth, layout.selectionRect.height - kScaleRightMarginVertical * 2); } else { layout.scaleLeftRect = g_EmptyRect; layout.scaleRightRect = g_EmptyRect; } if (canScaleX) { layout.leftLabelAnchor = new Vector2(layout.summaryRect.xMin - kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical); layout.rightLabelAnchor = new Vector2(layout.summaryRect.xMax + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical); } else { layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.summaryRect.center.x + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical); } return(layout); }