mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
增加Tooltip的offset参数配置偏移
This commit is contained in:
@@ -64,6 +64,7 @@ namespace XCharts
|
||||
[SerializeField] private float m_PaddingTopBottom = 5f;
|
||||
[SerializeField] private string m_IgnoreDataDefaultContent = "-";
|
||||
[SerializeField] private bool m_AlwayShow = false;
|
||||
[SerializeField] private Vector2 m_Offset = new Vector2(18f, -25f);
|
||||
[SerializeField] private Sprite m_BackgroundImage;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle(18, FontStyle.Normal);
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid, 0.7f);
|
||||
@@ -175,6 +176,10 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public bool alwayShow { get { return m_AlwayShow; } set { m_AlwayShow = value; } }
|
||||
/// <summary>
|
||||
/// 提示框相对于鼠标位置的偏移。
|
||||
/// </summary>
|
||||
public Vector2 offset { get { return m_Offset; } set { m_Offset = value; } }
|
||||
/// <summary>
|
||||
/// 提示框内容文本样式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace XCharts
|
||||
}
|
||||
if (m_Tooltip.IsSelected())
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
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)
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
}
|
||||
else if (m_Tooltip.IsActive())
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace XCharts
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
if (m_Tooltip.type == Tooltip.Type.Corss)
|
||||
{
|
||||
|
||||
@@ -678,7 +678,7 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace XCharts
|
||||
}
|
||||
if (selected)
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
}
|
||||
else if (m_Tooltip.IsActive())
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace XCharts
|
||||
}
|
||||
if (selected)
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
m_Tooltip.UpdateContentPos(local + m_Tooltip.offset);
|
||||
UpdateTooltip();
|
||||
}
|
||||
else if (m_Tooltip.IsActive())
|
||||
|
||||
Reference in New Issue
Block a user