增加EditorList+添加编辑功能

This commit is contained in:
monitor1394
2022-12-30 22:13:03 +08:00
parent c17d83ae6d
commit d90a0d69b2
2 changed files with 11 additions and 5 deletions

View File

@@ -65,6 +65,7 @@ slug: /changelog
## master
* (2022.12.29) 增加`Editor``List``+`添加编辑功能
* (2022.12.29) 修复`UpdateXYData()`接口影响数据精度的问题 (#238)
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
* (2022.12.22) 调整`Covert`重命名为`Convert`,涉及的接口有:`ConvertXYAxis()``CovertSerie()`

View File

@@ -318,8 +318,8 @@ namespace XCharts.Editor
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
var iconWidth = 14;
var iconGap = 3f;
var iconWidth = 10;
var iconGap = 0f;
if (showSize)
{
@@ -383,20 +383,25 @@ namespace XCharts.Editor
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie ?
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * iconWidth, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
var iconRect = new Rect(drawRect.width - 4 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
}
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
{