2019-05-11 04:33:54 +08:00
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
|
|
|
|
|
[CustomPropertyDrawer(typeof(Tooltip), true)]
|
|
|
|
|
|
public class TooltipDrawer : PropertyDrawer
|
|
|
|
|
|
{
|
|
|
|
|
|
private bool m_TooltipModuleToggle = false;
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
|
|
|
|
|
Rect drawRect = pos;
|
|
|
|
|
|
drawRect.height = EditorGUIUtility.singleLineHeight;
|
|
|
|
|
|
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
2019-07-18 09:42:36 +08:00
|
|
|
|
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
2019-05-11 04:33:54 +08:00
|
|
|
|
|
|
|
|
|
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
2019-05-29 09:53:30 +08:00
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
if (m_TooltipModuleToggle)
|
|
|
|
|
|
{
|
2019-07-18 09:42:36 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, type);
|
2019-05-29 09:53:30 +08:00
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
}
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
2019-06-21 09:34:33 +08:00
|
|
|
|
if (m_TooltipModuleToggle)
|
2019-07-18 09:42:36 +08:00
|
|
|
|
return 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
2019-05-29 09:53:30 +08:00
|
|
|
|
else
|
2019-07-18 09:42:36 +08:00
|
|
|
|
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|