From fdd686b038ba832b9e7f853cf9d1590d1022d659 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 4 May 2023 07:57:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`Symbol`=E9=80=89=E6=8B=A9`Cu?= =?UTF-8?q?stom`=E7=B1=BB=E5=9E=8B=E6=97=B6=E7=9A=84`Warning`=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Editor/ChildComponents/BasePropertyDrawer.cs | 8 ++++++++ Editor/ChildComponents/SerieSymbolDrawer.cs | 5 +++-- Editor/ChildComponents/SymbolStyleDrawer.cs | 3 ++- Runtime/Serie/SerieHelper.cs | 1 - 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 9816b0a9..7bb48b80 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -66,6 +66,7 @@ slug: /changelog ## master +* (2023.05.04) 增加`Symbol`选择`Custom`类型时的`Warning`提示 * (2023.04.15) 修复`DataZoom`在多个图表时可能异常的问题 (#252) * (2023.04.14) 修复`Tooltip`在只有一个数据时可能异常的问题 * (2023.04.14) 增加`BaseChart`的`TriggerTooltip()`接口尝试触发`ToolTip` diff --git a/Editor/ChildComponents/BasePropertyDrawer.cs b/Editor/ChildComponents/BasePropertyDrawer.cs index 77ae7b08..e5574085 100644 --- a/Editor/ChildComponents/BasePropertyDrawer.cs +++ b/Editor/ChildComponents/BasePropertyDrawer.cs @@ -73,6 +73,14 @@ namespace XCharts.Editor return prop.propertyPath + "_" + index; } + protected void AddHelpBox(string message, MessageType type = MessageType.Warning, int line = 2) + { + var offset = EditorGUI.indentLevel * ChartEditorHelper.INDENT_WIDTH; + EditorGUI.HelpBox(new Rect(m_DrawRect.x + offset, m_DrawRect.y, m_DrawRect.width - offset, EditorGUIUtility.singleLineHeight * line), message, type); + for (int i = 0; i < line; i++) + AddSingleLineHeight(); + } + protected void AddSingleLineHeight() { m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; diff --git a/Editor/ChildComponents/SerieSymbolDrawer.cs b/Editor/ChildComponents/SerieSymbolDrawer.cs index 31a132e4..47fa5db0 100644 --- a/Editor/ChildComponents/SerieSymbolDrawer.cs +++ b/Editor/ChildComponents/SerieSymbolDrawer.cs @@ -15,10 +15,11 @@ namespace XCharts.Editor if (MakeComponentFoldout(prop, "m_Show", true)) { ++EditorGUI.indentLevel; - var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex; + var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex; PropertyField(prop, "m_Type"); if (type == SymbolType.Custom) { + AddHelpBox("Custom symbol only work in PictorialBar serie", MessageType.Warning); PropertyField(prop, "m_Image"); PropertyField(prop, "m_ImageType"); PropertyField(prop, "m_Width"); @@ -27,7 +28,7 @@ namespace XCharts.Editor } PropertyField(prop, "m_Gap"); PropertyField(prop, "m_SizeType"); - switch ((SymbolSizeType) prop.FindPropertyRelative("m_SizeType").enumValueIndex) + switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex) { case SymbolSizeType.Custom: PropertyField(prop, "m_Size"); diff --git a/Editor/ChildComponents/SymbolStyleDrawer.cs b/Editor/ChildComponents/SymbolStyleDrawer.cs index 1ae59e29..edd66978 100644 --- a/Editor/ChildComponents/SymbolStyleDrawer.cs +++ b/Editor/ChildComponents/SymbolStyleDrawer.cs @@ -15,10 +15,11 @@ namespace XCharts.Editor if (MakeComponentFoldout(prop, "m_Show", true)) { ++EditorGUI.indentLevel; - var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex; + var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex; PropertyField(prop, "m_Type"); if (type == SymbolType.Custom) { + AddHelpBox("Custom Symbol only work in PictorialBar serie", MessageType.Warning); PropertyField(prop, "m_Image"); PropertyField(prop, "m_ImageType"); PropertyField(prop, "m_Width"); diff --git a/Runtime/Serie/SerieHelper.cs b/Runtime/Serie/SerieHelper.cs index 3cd8a705..73f18197 100644 --- a/Runtime/Serie/SerieHelper.cs +++ b/Runtime/Serie/SerieHelper.cs @@ -760,7 +760,6 @@ namespace XCharts.Runtime } } - private static List emptyFilter = new List(); /// /// 根据dataZoom更新数据列表缓存 ///