-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c651f7e
commit d41c13c
Showing
6 changed files
with
147 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Assets/XCharts/Scripts/Editor/PropertyDrawers/AxisLineDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace XCharts | ||
{ | ||
[CustomPropertyDrawer(typeof(Axis.AxisLine), true)] | ||
public class AxisLineDrawer : PropertyDrawer | ||
{ | ||
private bool m_AxisLineToggle = 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_Symbol = prop.FindPropertyRelative("m_Symbol"); | ||
SerializedProperty m_SymbolWidth = prop.FindPropertyRelative("m_SymbolWidth"); | ||
SerializedProperty m_SymbolHeight = prop.FindPropertyRelative("m_SymbolHeight"); | ||
SerializedProperty m_SymbolOffset = prop.FindPropertyRelative("m_SymbolOffset"); | ||
SerializedProperty m_SymbolDent = prop.FindPropertyRelative("m_SymbolDent"); | ||
|
||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLineToggle, "Axis Line", show, false); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
if (m_AxisLineToggle) | ||
{ | ||
++EditorGUI.indentLevel; | ||
EditorGUI.PropertyField(drawRect, m_Symbol); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
EditorGUI.PropertyField(drawRect, m_SymbolWidth); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
EditorGUI.PropertyField(drawRect, m_SymbolHeight); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
EditorGUI.PropertyField(drawRect, m_SymbolOffset); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
EditorGUI.PropertyField(drawRect, m_SymbolDent); | ||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; | ||
--EditorGUI.indentLevel; | ||
} | ||
} | ||
|
||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) | ||
{ | ||
float height = 0; | ||
if (m_AxisLineToggle) | ||
{ | ||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing; | ||
} | ||
return height; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/XCharts/Scripts/Editor/PropertyDrawers/AxisLineDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters