diff --git a/Editor/PropertyDrawers/TooltipDrawer.cs b/Editor/PropertyDrawers/TooltipDrawer.cs
index 8e0e5595..3403b001 100644
--- a/Editor/PropertyDrawers/TooltipDrawer.cs
+++ b/Editor/PropertyDrawers/TooltipDrawer.cs
@@ -31,11 +31,13 @@ namespace XCharts
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
SerializedProperty m_ForceENotation = prop.FindPropertyRelative("m_ForceENotation");
+ SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_TooltipModuleToggle)
{
+ EditorGUI.indentLevel++;
EditorGUI.PropertyField(drawRect, type);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Formatter);
@@ -58,13 +60,17 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ForceENotation);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, m_LineStyle);
+ drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
+ EditorGUI.indentLevel--;
}
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
if (m_TooltipModuleToggle)
- return 12 * EditorGUIUtility.singleLineHeight + 11 * EditorGUIUtility.standardVerticalSpacing;
+ return 12 * EditorGUIUtility.singleLineHeight + 11 * EditorGUIUtility.standardVerticalSpacing +
+ EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
else
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
diff --git a/Runtime/Component/Main/Tooltip.cs b/Runtime/Component/Main/Tooltip.cs
index 0b8cced2..131a0bbb 100644
--- a/Runtime/Component/Main/Tooltip.cs
+++ b/Runtime/Component/Main/Tooltip.cs
@@ -58,6 +58,7 @@ namespace XCharts
[SerializeField] private int m_FontSize = 18;
[SerializeField] private FontStyle m_FontStyle = FontStyle.Normal;
[SerializeField] private bool m_ForceENotation = false;
+ [SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid,0.7f);
private GameObject m_GameObject;
private GameObject m_Content;
@@ -146,6 +147,10 @@ namespace XCharts
/// 是否强制使用科学计数法格式化显示数值。默认为false,当小数精度大于3时才采用科学计数法。
///
public bool forceENotation { get { return m_ForceENotation; } set { m_ForceENotation = value; } }
+ ///
+ /// 指示线样式。
+ ///
+ public LineStyle lineStyle { get { return m_LineStyle; } set { if (value != null) m_LineStyle = value; } }
///
/// The data index currently indicated by Tooltip.
@@ -476,5 +481,21 @@ namespace XCharts
return content;
}
}
+
+ internal Color GetLineColor(ThemeInfo theme)
+ {
+ if (lineStyle.color != Color.clear)
+ {
+ var color = lineStyle.color;
+ color.a *= lineStyle.opacity;
+ return color;
+ }
+ else
+ {
+ var color = (Color)theme.tooltipLineColor;
+ color.a *= lineStyle.opacity;
+ return color;
+ }
+ }
}
}
\ No newline at end of file