mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-31 13:58:48 +00:00
增加Tooltip的offset参数配置偏移
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.07.07) 增加`Tooltip`的`offset`参数配置偏移
|
||||||
* (2020.07.06) 增加`LiquidChart`水位图
|
* (2020.07.06) 增加`LiquidChart`水位图
|
||||||
* (2020.07.01) 增加`PolarChart`极坐标图表
|
* (2020.07.01) 增加`PolarChart`极坐标图表
|
||||||
* (2020.06.25) 发布`v1.5.2`版本
|
* (2020.06.25) 发布`v1.5.2`版本
|
||||||
|
|||||||
@@ -232,6 +232,8 @@
|
|||||||
* `backgroundImage`:提示框的背景图。
|
* `backgroundImage`:提示框的背景图。
|
||||||
* `ignoreDataDefaultContent`:被忽略数据的默认显示字符信息。
|
* `ignoreDataDefaultContent`:被忽略数据的默认显示字符信息。
|
||||||
* `alwayShow`:是否触发后一直显示。
|
* `alwayShow`:是否触发后一直显示。
|
||||||
|
* `offset`:`(since v1.5.3)`提示框相对于鼠标位置的偏移。
|
||||||
|
|
||||||
* `lineStyle`:指示器线条样式 [LineStyle](#LineStyle)。
|
* `lineStyle`:指示器线条样式 [LineStyle](#LineStyle)。
|
||||||
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
|
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace XCharts
|
|||||||
SerializedProperty m_IgnoreDataDefaultContent = prop.FindPropertyRelative("m_IgnoreDataDefaultContent");
|
SerializedProperty m_IgnoreDataDefaultContent = prop.FindPropertyRelative("m_IgnoreDataDefaultContent");
|
||||||
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||||
SerializedProperty m_TextStyle = prop.FindPropertyRelative("m_TextStyle");
|
SerializedProperty m_TextStyle = prop.FindPropertyRelative("m_TextStyle");
|
||||||
|
SerializedProperty m_Offset = prop.FindPropertyRelative("m_Offset");
|
||||||
|
|
||||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
@@ -67,6 +68,8 @@ namespace XCharts
|
|||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_IgnoreDataDefaultContent);
|
EditorGUI.PropertyField(drawRect, m_IgnoreDataDefaultContent);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
EditorGUI.PropertyField(drawRect, m_Offset);
|
||||||
|
drawRect.y += EditorGUI.GetPropertyHeight(m_Offset);
|
||||||
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
||||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
||||||
EditorGUI.PropertyField(drawRect, m_TextStyle);
|
EditorGUI.PropertyField(drawRect, m_TextStyle);
|
||||||
@@ -79,6 +82,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (m_TooltipModuleToggle)
|
if (m_TooltipModuleToggle)
|
||||||
return 14 * EditorGUIUtility.singleLineHeight + 13 * EditorGUIUtility.standardVerticalSpacing +
|
return 14 * EditorGUIUtility.singleLineHeight + 13 * EditorGUIUtility.standardVerticalSpacing +
|
||||||
|
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Offset")) +
|
||||||
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle")) +
|
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle")) +
|
||||||
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TextStyle"));
|
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TextStyle"));
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_PaddingTopBottom = 5f;
|
[SerializeField] private float m_PaddingTopBottom = 5f;
|
||||||
[SerializeField] private string m_IgnoreDataDefaultContent = "-";
|
[SerializeField] private string m_IgnoreDataDefaultContent = "-";
|
||||||
[SerializeField] private bool m_AlwayShow = false;
|
[SerializeField] private bool m_AlwayShow = false;
|
||||||
|
[SerializeField] private Vector2 m_Offset = new Vector2(18f, -25f);
|
||||||
[SerializeField] private Sprite m_BackgroundImage;
|
[SerializeField] private Sprite m_BackgroundImage;
|
||||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle(18, FontStyle.Normal);
|
[SerializeField] private TextStyle m_TextStyle = new TextStyle(18, FontStyle.Normal);
|
||||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid, 0.7f);
|
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid, 0.7f);
|
||||||
@@ -175,6 +176,10 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool alwayShow { get { return m_AlwayShow; } set { m_AlwayShow = value; } }
|
public bool alwayShow { get { return m_AlwayShow; } set { m_AlwayShow = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 提示框相对于鼠标位置的偏移。
|
||||||
|
/// </summary>
|
||||||
|
public Vector2 offset { get { return m_Offset; } set { m_Offset = value; } }
|
||||||
|
/// <summary>
|
||||||
/// 提示框内容文本样式。
|
/// 提示框内容文本样式。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TextStyle textStyle
|
public TextStyle textStyle
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (m_Tooltip.IsSelected())
|
if (m_Tooltip.IsSelected())
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
if (m_Tooltip.IsDataIndexChanged() || m_Tooltip.type == Tooltip.Type.Corss)
|
if (m_Tooltip.IsDataIndexChanged() || m_Tooltip.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e78d1b28fc61d4b1b995a1eca16cf3b6
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 15e5106bd46f5484596429d512f6af5d
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -457,7 +457,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
}
|
}
|
||||||
else if (m_Tooltip.IsActive())
|
else if (m_Tooltip.IsActive())
|
||||||
|
|||||||
@@ -576,7 +576,7 @@ namespace XCharts
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
if (m_Tooltip.type == Tooltip.Type.Corss)
|
if (m_Tooltip.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
}
|
}
|
||||||
else if (m_Tooltip.IsActive())
|
else if (m_Tooltip.IsActive())
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||||
UpdateTooltip();
|
UpdateTooltip();
|
||||||
}
|
}
|
||||||
else if (m_Tooltip.IsActive())
|
else if (m_Tooltip.IsActive())
|
||||||
|
|||||||
Reference in New Issue
Block a user