public void OnGUI() { if (this.hasSelection) { if (Event.current.type == EventType.Repaint) { CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags; if (rectangleToolFlags != CurveEditorSettings.RectangleToolFlags.NoRectangleTool) { Color color = GUI.color; GUI.color = Color.white; this.m_Layout = this.CalculateLayout(); if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool) { GUI.Label(this.m_Layout.selectionLeftRect, GUIContent.none, base.styles.rectangleToolHighlight); GUI.Label(this.m_Layout.selectionTopRect, GUIContent.none, base.styles.rectangleToolHighlight); GUI.Label(this.m_Layout.underlayLeftRect, GUIContent.none, base.styles.rectangleToolHighlight); GUI.Label(this.m_Layout.underlayTopRect, GUIContent.none, base.styles.rectangleToolHighlight); } this.m_SelectionBox.OnGUI(this.m_Layout.selectionRect); this.m_SelectionScaleTop.OnGUI(this.m_Layout.scaleTopRect); this.m_SelectionScaleBottom.OnGUI(this.m_Layout.scaleBottomRect); this.m_SelectionScaleLeft.OnGUI(this.m_Layout.scaleLeftRect); this.m_SelectionScaleRight.OnGUI(this.m_Layout.scaleRightRect); GUI.color = color; } } } }
private CurveEditorRectangleTool.ToolLayout CalculateLayout() { CurveEditorRectangleTool.ToolLayout result = default(CurveEditorRectangleTool.ToolLayout); bool flag = !Mathf.Approximately(this.selectionBounds.size.x, 0f); bool flag2 = !Mathf.Approximately(this.selectionBounds.size.y, 0f); float num = base.TimeToPixel(this.selectionBounds.min.x); float num2 = base.TimeToPixel(this.selectionBounds.max.x); float num3 = base.ValueToPixel(this.selectionBounds.max.y); float num4 = base.ValueToPixel(this.selectionBounds.min.y); result.selectionRect = new Rect(num, num3, num2 - num, num4 - num3); result.displayHScale = true; float num5 = result.selectionRect.width - 15f - 15f; if (num5 < 14f) { result.displayHScale = false; num5 = result.selectionRect.width; if (num5 < 14f) { result.selectionRect.x = result.selectionRect.center.x - 7f; result.selectionRect.width = 14f; num5 = 14f; } } if (result.displayHScale) { result.hBarLeftRect = new Rect(result.selectionRect.xMin, base.contentRect.yMin, 15f, 13f); result.hBarRect = new Rect(result.hBarLeftRect.xMax, base.contentRect.yMin, num5, 13f); result.hBarRightRect = new Rect(result.hBarRect.xMax, base.contentRect.yMin, 15f, 13f); } else { result.hBarRect = new Rect(result.selectionRect.xMin, base.contentRect.yMin, num5, 13f); result.hBarLeftRect = new Rect(0f, 0f, 0f, 0f); result.hBarRightRect = new Rect(0f, 0f, 0f, 0f); } result.displayVScale = true; float num6 = result.selectionRect.height - 15f - 15f; if (num6 < 15f) { result.displayVScale = false; num6 = result.selectionRect.height; if (num6 < 15f) { result.selectionRect.y = result.selectionRect.center.y - 7.5f; result.selectionRect.height = 15f; num6 = 15f; } } if (result.displayVScale) { result.vBarTopRect = new Rect(base.contentRect.xMin, result.selectionRect.yMin, 13f, 15f); result.vBarRect = new Rect(base.contentRect.xMin, result.vBarTopRect.yMax, 13f, num6); result.vBarBottomRect = new Rect(base.contentRect.xMin, result.vBarRect.yMax, 13f, 15f); } else { result.vBarRect = new Rect(base.contentRect.xMin, result.selectionRect.yMin, 13f, num6); result.vBarTopRect = CurveEditorRectangleTool.g_EmptyRect; result.vBarBottomRect = CurveEditorRectangleTool.g_EmptyRect; } if (flag) { float num7 = 0.099999994f; float num8 = 0.099999994f; result.scaleLeftRect = new Rect(result.selectionRect.xMin - 17f, result.selectionRect.yMin + result.selectionRect.height * num7, 17f, result.selectionRect.height * 0.8f); result.scaleRightRect = new Rect(result.selectionRect.xMax, result.selectionRect.yMin + result.selectionRect.height * num8, 17f, result.selectionRect.height * 0.8f); } else { result.scaleLeftRect = CurveEditorRectangleTool.g_EmptyRect; result.scaleRightRect = CurveEditorRectangleTool.g_EmptyRect; } if (flag2) { float num9 = 0.099999994f; float num10 = 0.099999994f; result.scaleTopRect = new Rect(result.selectionRect.xMin + result.selectionRect.width * num10, result.selectionRect.yMin - 17f, result.selectionRect.width * 0.8f, 17f); result.scaleBottomRect = new Rect(result.selectionRect.xMin + result.selectionRect.width * num9, result.selectionRect.yMax, result.selectionRect.width * 0.8f, 17f); } else { result.scaleTopRect = CurveEditorRectangleTool.g_EmptyRect; result.scaleBottomRect = CurveEditorRectangleTool.g_EmptyRect; } if (flag) { result.leftLabelAnchor = new Vector2(result.selectionRect.xMin - 3f, base.contentRect.yMin + 1f); result.rightLabelAnchor = new Vector2(result.selectionRect.xMax + 3f, base.contentRect.yMin + 1f); } else { result.leftLabelAnchor = (result.rightLabelAnchor = new Vector2(result.selectionRect.xMax + 3f, base.contentRect.yMin + 1f)); } if (flag2) { result.bottomLabelAnchor = new Vector2(base.contentRect.xMin + 1f, result.selectionRect.yMax + 2f); result.topLabelAnchor = new Vector2(base.contentRect.xMin + 1f, result.selectionRect.yMin - 2f); } else { result.bottomLabelAnchor = (result.topLabelAnchor = new Vector2(base.contentRect.xMin + 1f, result.selectionRect.yMin - 2f)); } result.selectionLeftRect = new Rect(base.contentRect.xMin + 13f, result.selectionRect.yMin, result.selectionRect.xMin - 13f, result.selectionRect.height); result.selectionTopRect = new Rect(result.selectionRect.xMin, base.contentRect.yMin + 13f, result.selectionRect.width, result.selectionRect.yMin - 13f); result.underlayTopRect = new Rect(base.contentRect.xMin, base.contentRect.yMin, base.contentRect.width, 13f); result.underlayLeftRect = new Rect(base.contentRect.xMin, base.contentRect.yMin + 13f, 13f, base.contentRect.height - 13f); return(result); }