mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
LineChart增加stepType实现`阶梯线图
This commit is contained in:
@@ -13,6 +13,8 @@ namespace XCharts
|
||||
SerializedProperty m_Smooth;
|
||||
SerializedProperty m_SmoothStyle;
|
||||
SerializedProperty m_Area;
|
||||
SerializedProperty m_Step;
|
||||
SerializedProperty m_StepType;
|
||||
|
||||
private bool m_LineModuleToggle = false;
|
||||
|
||||
@@ -24,6 +26,8 @@ namespace XCharts
|
||||
m_Smooth = prop.FindPropertyRelative("m_Smooth");
|
||||
m_SmoothStyle = prop.FindPropertyRelative("m_SmoothStyle");
|
||||
m_Area = prop.FindPropertyRelative("m_Area");
|
||||
m_Step = prop.FindPropertyRelative("m_Step");
|
||||
m_StepType = prop.FindPropertyRelative("m_StepType");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
@@ -72,6 +76,22 @@ namespace XCharts
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_Step);
|
||||
if (m_Step.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect, "Type");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_StepType, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Area);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
@@ -82,7 +102,7 @@ namespace XCharts
|
||||
{
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user