mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 05:08:48 +00:00
增加Editor对List的+添加编辑功能
This commit is contained in:
@@ -65,6 +65,7 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2022.12.29) 增加`Editor`对`List`的`+`添加编辑功能
|
||||||
* (2022.12.29) 修复`UpdateXYData()`接口影响数据精度的问题 (#238)
|
* (2022.12.29) 修复`UpdateXYData()`接口影响数据精度的问题 (#238)
|
||||||
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
|
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
|
||||||
* (2022.12.22) 调整`Covert`重命名为`Convert`,涉及的接口有:`ConvertXYAxis()`,`CovertSerie()`等
|
* (2022.12.22) 调整`Covert`重命名为`Convert`,涉及的接口有:`ConvertXYAxis()`,`CovertSerie()`等
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ namespace XCharts.Editor
|
|||||||
{
|
{
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
var listSize = listProp.arraySize;
|
var listSize = listProp.arraySize;
|
||||||
var iconWidth = 14;
|
var iconWidth = 10;
|
||||||
var iconGap = 3f;
|
var iconGap = 0f;
|
||||||
|
|
||||||
if (showSize)
|
if (showSize)
|
||||||
{
|
{
|
||||||
@@ -383,20 +383,25 @@ namespace XCharts.Editor
|
|||||||
var isSerie = "Serie".Equals(element.type);
|
var isSerie = "Serie".Equals(element.type);
|
||||||
var elementRect = isSerie ?
|
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 + 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));
|
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;
|
var oldColor = GUI.contentColor;
|
||||||
GUI.contentColor = Color.black;
|
GUI.contentColor = Color.black;
|
||||||
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
||||||
{
|
{
|
||||||
if (i > 0) listProp.MoveArrayElement(i, i - 1);
|
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 (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
|
||||||
{
|
{
|
||||||
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
|
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);
|
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||||
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user