3.0 - polar chart

This commit is contained in:
monitor1394
2022-01-26 20:47:14 +08:00
parent a32f5f5bcf
commit cc4ee3735c
41 changed files with 566 additions and 165 deletions

View File

@@ -14,7 +14,7 @@ namespace XCharts
[Serializable]
[ComponentHandler(typeof(PolarCoordHandler), true)]
[RequireChartComponent(typeof(AngleAxis), typeof(RadiusAxis))]
public class PolarCoord : CoordSystem
public class PolarCoord : CoordSystem, ISerieContainer
{
[SerializeField] private bool m_Show = true;
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.45f };
@@ -63,5 +63,14 @@ namespace XCharts
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
}
public bool IsPointerEnter()
{
return context.isPointerEnter;
}
public bool Contains(Vector3 pos)
{
return Vector3.Distance(pos, context.center) < context.radius;
}
}
}

View File

@@ -16,5 +16,6 @@ namespace XCharts
/// 极坐标的运行时实际半径。
/// </summary>
public float radius { get; internal set; }
public bool isPointerEnter { get; set; }
}
}

View File

@@ -12,6 +12,11 @@ namespace XCharts
public override void Update()
{
PolarHelper.UpdatePolarCenter(component, chart.chartPosition, chart.chartWidth, chart.chartHeight);
if (chart.isPointerInChart)
component.context.isPointerEnter = component.Contains(chart.pointerPos);
else
component.context.isPointerEnter = false;
}
public override void DrawBase(VertexHelper vh)