BezierCurves.BezierCurve3DEditor.DrawElementCallback C# (CSharp) Method

DrawElementCallback() private method

private DrawElementCallback ( Rect rect, int index, bool isActive, bool isFocused ) : void
rect UnityEngine.Rect
index int
isActive bool
isFocused bool
return void
        private void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            var element = this.keyPoints.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;

            // Draw "Add Before" button
            if (GUI.Button(new Rect(rect.x, rect.y, AddButtonWidth, EditorGUIUtility.singleLineHeight), new GUIContent("Add Before")))
            {
                AddKeyPointAt(this.curve, index);
            }

            // Draw point name
            EditorGUI.PropertyField(
                new Rect(rect.x + AddButtonWidth + 5f, rect.y, rect.width - AddButtonWidth * 2f - 35f, EditorGUIUtility.singleLineHeight), element, GUIContent.none);

            // Draw "Add After" button
            if (GUI.Button(new Rect(rect.width - AddButtonWidth + 8f, rect.y, AddButtonWidth, EditorGUIUtility.singleLineHeight), new GUIContent("Add After")))
            {
                AddKeyPointAt(this.curve, index + 1);
            }

            // Draw remove button
            if (this.curve.KeyPointsCount > 2)
            {
                if (GUI.Button(new Rect(rect.width + 14f, rect.y, RemoveButtonWidth, EditorGUIUtility.singleLineHeight), new GUIContent("x")))
                {
                    RemoveKeyPointAt(this.curve, index);
                }
            }
        }