mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 22:40:10 +00:00
增加Tooltip指示器类型,优化显示控制
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user