增加Tooltip指示器类型,优化显示控制

This commit is contained in:
monitor1394
2019-07-18 09:42:36 +08:00
parent f9a853dee4
commit 9ed5c5b277
15 changed files with 52998 additions and 217127 deletions

View File

@@ -9,6 +9,7 @@ namespace XCharts
SerializedProperty m_Tickness;
SerializedProperty m_Point;
SerializedProperty m_PointWidth;
SerializedProperty m_PointSelectedWidth;
SerializedProperty m_Smooth;
SerializedProperty m_SmoothStyle;
SerializedProperty m_Area;
@@ -22,6 +23,7 @@ namespace XCharts
m_Tickness = prop.FindPropertyRelative("m_Tickness");
m_Point = prop.FindPropertyRelative("m_Point");
m_PointWidth = prop.FindPropertyRelative("m_PointWidth");
m_PointSelectedWidth = prop.FindPropertyRelative("m_PointSelectedWidth");
m_Smooth = prop.FindPropertyRelative("m_Smooth");
m_SmoothStyle = prop.FindPropertyRelative("m_SmoothStyle");
m_Area = prop.FindPropertyRelative("m_Area");
@@ -43,22 +45,18 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, m_Tickness);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.width = EditorGUIUtility.labelWidth + 10;
EditorGUI.PropertyField(drawRect, m_Point);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_Point.boolValue)
{
drawRect.x = EditorGUIUtility.labelWidth + 15;
EditorGUI.LabelField(drawRect, "Width");
drawRect.x = EditorGUIUtility.labelWidth + 65;
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
if (tempWidth < 20) tempWidth = 20;
drawRect.width = tempWidth;
EditorGUI.PropertyField(drawRect, m_PointWidth, GUIContent.none);
drawRect.x = pos.x;
drawRect.width = pos.width;
}
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
++EditorGUI.indentLevel;
EditorGUI.PropertyField(drawRect, m_PointWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_PointSelectedWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
--EditorGUI.indentLevel;
}
drawRect.width = EditorGUIUtility.labelWidth + 10;
EditorGUI.PropertyField(drawRect, m_Smooth);
if (m_Smooth.boolValue)
@@ -99,9 +97,15 @@ namespace XCharts
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
float height = 0;
if (m_LineModuleToggle)
{
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
height = 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
var m_Point = prop.FindPropertyRelative("m_Point");
if(m_Point.boolValue){
height += 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
}
return height;
}
else
{

View File

@@ -13,13 +13,14 @@ namespace XCharts
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty crossLabel = prop.FindPropertyRelative("m_CrossLabel");
SerializedProperty type = prop.FindPropertyRelative("m_Type");
SerializedProperty trigger = prop.FindPropertyRelative("m_Trigger");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_TooltipModuleToggle)
{
EditorGUI.PropertyField(drawRect, crossLabel);
EditorGUI.PropertyField(drawRect, type);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
@@ -27,9 +28,9 @@ namespace XCharts
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
if (m_TooltipModuleToggle)
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
return 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
else
return 1 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
}