mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 20:28:46 +00:00
修复鼠标不在区域内Tooltip还显示的问题
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -312,7 +312,16 @@ namespace XCharts
|
|||||||
|
|
||||||
private void CheckTooltip()
|
private void CheckTooltip()
|
||||||
{
|
{
|
||||||
if (!m_Tooltip.show || !m_Tooltip.isInited) return;
|
if (!m_Tooltip.show || !m_Tooltip.isInited)
|
||||||
|
{
|
||||||
|
if(m_Tooltip.dataIndex != 0)
|
||||||
|
{
|
||||||
|
m_Tooltip.dataIndex = 0;
|
||||||
|
m_Tooltip.SetActive(false);
|
||||||
|
RefreshChart();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_Tooltip.SetLabelActive(m_Tooltip.crossLabel);
|
m_Tooltip.SetLabelActive(m_Tooltip.crossLabel);
|
||||||
m_Tooltip.dataIndex = 0;
|
m_Tooltip.dataIndex = 0;
|
||||||
|
|
||||||
@@ -320,11 +329,16 @@ namespace XCharts
|
|||||||
|
|
||||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||||
Input.mousePosition, null, out local))
|
Input.mousePosition, null, out local))
|
||||||
|
{
|
||||||
|
m_Tooltip.SetActive(false);
|
||||||
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)
|
||||||
|
{
|
||||||
|
m_Tooltip.SetActive(false);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
m_Tooltip.pointerPos = local;
|
m_Tooltip.pointerPos = local;
|
||||||
CheckTootipArea(local);
|
CheckTootipArea(local);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace XCharts
|
|||||||
[NonSerialized] private RectTransform m_LabelRectX;
|
[NonSerialized] private RectTransform m_LabelRectX;
|
||||||
[NonSerialized] private RectTransform m_LabelRectY;
|
[NonSerialized] private RectTransform m_LabelRectY;
|
||||||
|
|
||||||
public bool show { get { return m_Show; }set { m_Show = value; } }
|
public bool show { get { return m_Show; }set { m_Show = value; SetActive(value); } }
|
||||||
public bool crossLabel { get { return m_CrossLabel; } set { m_CrossLabel = value; } }
|
public bool crossLabel { get { return m_CrossLabel; } set { m_CrossLabel = value; } }
|
||||||
|
|
||||||
public int dataIndex { get; set; }
|
public int dataIndex { get; set; }
|
||||||
@@ -119,7 +119,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public void SetActive(bool flag)
|
public void SetActive(bool flag)
|
||||||
{
|
{
|
||||||
if(m_GameObject)
|
if(m_GameObject && m_GameObject.activeInHierarchy != flag)
|
||||||
m_GameObject.SetActive(flag);
|
m_GameObject.SetActive(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user