mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Tooltip显示优化
This commit is contained in:
@@ -6,6 +6,12 @@ using UnityEngine.EventSystems;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
public enum Orient
|
||||||
|
{
|
||||||
|
Horizonal,
|
||||||
|
Vertical
|
||||||
|
}
|
||||||
|
|
||||||
public class BaseChart : MaskableGraphic
|
public class BaseChart : MaskableGraphic
|
||||||
{
|
{
|
||||||
private static readonly string s_TitleObjectName = "title";
|
private static readonly string s_TitleObjectName = "title";
|
||||||
@@ -331,12 +337,14 @@ namespace XCharts
|
|||||||
Input.mousePosition, null, out local))
|
Input.mousePosition, null, out local))
|
||||||
{
|
{
|
||||||
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)
|
||||||
{
|
{
|
||||||
m_Tooltip.SetActive(false);
|
m_Tooltip.SetActive(false);
|
||||||
|
RefreshChart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Tooltip.pointerPos = local;
|
m_Tooltip.pointerPos = local;
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ namespace XCharts
|
|||||||
|
|
||||||
protected override void CheckTootipArea(Vector2 local)
|
protected override void CheckTootipArea(Vector2 local)
|
||||||
{
|
{
|
||||||
if (local.x < zeroX || local.x > zeroX + coordinateWid ||
|
if (local.x < coordinateX || local.x > coordinateX + coordinateWid ||
|
||||||
local.y < zeroY || local.y > zeroY + coordinateHig)
|
local.y < coordinateY || local.y > coordinateY + coordinateHig)
|
||||||
{
|
{
|
||||||
m_Tooltip.dataIndex = 0;
|
m_Tooltip.dataIndex = 0;
|
||||||
RefreshTooltip();
|
RefreshTooltip();
|
||||||
|
|||||||
@@ -8,12 +8,6 @@ namespace XCharts
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class Legend : JsonDataSupport, IPropertyChanged, IEquatable<Legend>
|
public class Legend : JsonDataSupport, IPropertyChanged, IEquatable<Legend>
|
||||||
{
|
{
|
||||||
public enum Orient
|
|
||||||
{
|
|
||||||
Horizonal,
|
|
||||||
Vertical
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField] private bool m_Show = true;
|
[SerializeField] private bool m_Show = true;
|
||||||
[SerializeField] private Orient m_Orient = Orient.Horizonal;
|
[SerializeField] private Orient m_Orient = Orient.Horizonal;
|
||||||
[SerializeField] private Location m_Location = Location.defaultRight;
|
[SerializeField] private Location m_Location = Location.defaultRight;
|
||||||
|
|||||||
@@ -119,7 +119,8 @@ namespace XCharts
|
|||||||
|
|
||||||
public void SetActive(bool flag)
|
public void SetActive(bool flag)
|
||||||
{
|
{
|
||||||
if(m_GameObject && m_GameObject.activeInHierarchy != flag)
|
lastDataIndex = 0;
|
||||||
|
if (m_GameObject && m_GameObject.activeInHierarchy != flag)
|
||||||
m_GameObject.SetActive(flag);
|
m_GameObject.SetActive(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24621
Assets/demo_test.unity
24621
Assets/demo_test.unity
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 26cf64592dc72ea409130f458c00432f
|
|
||||||
timeCreated: 1553641976
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Reference in New Issue
Block a user