mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 14:30:10 +00:00
修复Tooltip在鼠标移出图表外可能绘制异常的问题
This commit is contained in:
@@ -381,9 +381,9 @@ namespace XCharts
|
||||
{
|
||||
if (!m_Tooltip.show || !m_Tooltip.inited)
|
||||
{
|
||||
if (m_Tooltip.dataIndex[0] != 0 || m_Tooltip.dataIndex[1] != 0)
|
||||
if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.dataIndex[0] = m_Tooltip.dataIndex[1] = -1;
|
||||
m_Tooltip.ClearValue();
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
@@ -399,15 +399,21 @@ namespace XCharts
|
||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||
Input.mousePosition, canvas.worldCamera, out local))
|
||||
{
|
||||
if (m_Tooltip.IsActive()) RefreshChart();
|
||||
m_Tooltip.SetActive(false);
|
||||
if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (local.x < 0 || local.x > chartWidth ||
|
||||
local.y < 0 || local.y > chartHeight)
|
||||
{
|
||||
if (m_Tooltip.IsActive()) RefreshChart();
|
||||
m_Tooltip.SetActive(false);
|
||||
if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_Tooltip.pointerPos = local;
|
||||
|
||||
@@ -162,9 +162,10 @@ namespace XCharts
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +193,11 @@ namespace XCharts
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -519,9 +519,10 @@ namespace XCharts
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
RefreshTooltip();
|
||||
}
|
||||
else
|
||||
else if(m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +472,11 @@ namespace XCharts
|
||||
int serieIndex = m_Tooltip.dataIndex[0];
|
||||
if (serieIndex < 0)
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
if (m_Tooltip.IsActive())
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_Tooltip.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user