2019-10-22 04:09:04 +08:00
|
|
|
|
/******************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using UnityEditor;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
2019-07-13 16:38:38 +08:00
|
|
|
|
[CustomPropertyDrawer(typeof(AxisTick), true)]
|
2019-05-11 04:33:54 +08:00
|
|
|
|
public class AxisTickDrawer : PropertyDrawer
|
|
|
|
|
|
{
|
|
|
|
|
|
private bool m_AxisTickToggle = false;
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
|
|
|
|
|
Rect drawRect = pos;
|
|
|
|
|
|
drawRect.height = EditorGUIUtility.singleLineHeight;
|
|
|
|
|
|
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
|
|
|
|
|
SerializedProperty m_AlignWithLabel = prop.FindPropertyRelative("m_AlignWithLabel");
|
|
|
|
|
|
SerializedProperty m_Inside = prop.FindPropertyRelative("m_Inside");
|
|
|
|
|
|
SerializedProperty m_Length = prop.FindPropertyRelative("m_Length");
|
2020-03-20 08:47:34 +08:00
|
|
|
|
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
|
2019-05-11 04:33:54 +08:00
|
|
|
|
|
|
|
|
|
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisTickToggle, "Axis Tick", show, false);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
if (m_AxisTickToggle)
|
|
|
|
|
|
{
|
|
|
|
|
|
++EditorGUI.indentLevel;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_AlignWithLabel);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_Inside);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
|
|
|
|
|
EditorGUI.PropertyField(drawRect, m_Length);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2020-03-20 08:47:34 +08:00
|
|
|
|
EditorGUI.PropertyField(drawRect, m_Width);
|
|
|
|
|
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
--EditorGUI.indentLevel;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
|
|
|
|
|
{
|
|
|
|
|
|
float height = 0;
|
|
|
|
|
|
if (m_AxisTickToggle)
|
|
|
|
|
|
{
|
2020-03-20 08:47:34 +08:00
|
|
|
|
height += 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
2019-05-11 04:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
return height;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|