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