优化代码,更好的支持自定义图表

This commit is contained in:
monitor1394
2021-04-28 06:56:28 +08:00
parent 6a76f25b7d
commit 6ded23a72e
5 changed files with 6 additions and 8 deletions

View File

@@ -209,14 +209,12 @@ namespace XCharts
if (m_Flodouts[prop.displayName])
{
EditorGUI.indentLevel++;
//prop.arraySize = EditorGUILayout.IntField("Size", prop.arraySize);
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
currRect.y -= EditorGUIUtility.singleLineHeight;
var rect1 = new Rect(currRect.width + k_IconXOffset,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
EditorGUI.DrawRect(rect1, Color.blue);
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd))// ChartEditorHelper.Styles.invisibleButton))
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd, ChartEditorHelper.Styles.invisibleButton))
{
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;