Files
XCharts/Runtime/Coord/Polar/PolarCoordHandler.cs

49 lines
1.6 KiB
C#
Raw Normal View History

2021-11-23 13:20:07 +08:00
using System;
using UnityEngine;
using UnityEngine.UI;
using XUGL;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2021-11-23 13:20:07 +08:00
{
[UnityEngine.Scripting.Preserve]
internal sealed class PolarCoordHandler : MainComponentHandler<PolarCoord>
{
public override void Update()
{
base.Update();
2021-11-23 13:20:07 +08:00
PolarHelper.UpdatePolarCenter(component, chart.chartPosition, chart.chartWidth, chart.chartHeight);
2022-01-26 20:47:14 +08:00
if (chart.isPointerInChart)
component.context.isPointerEnter = component.Contains(chart.pointerPos);
else
component.context.isPointerEnter = false;
2021-11-23 13:20:07 +08:00
}
public override void DrawBase(VertexHelper vh)
{
DrawPolar(vh, component);
}
private void DrawPolar(VertexHelper vh, PolarCoord polar)
{
PolarHelper.UpdatePolarCenter(polar, chart.chartPosition, chart.chartWidth, chart.chartHeight);
if (polar.show && !ChartHelper.IsClearColor(polar.backgroundColor))
2021-11-23 13:20:07 +08:00
{
if (polar.context.insideRadius > 0)
{
UGL.DrawDoughnut(vh, polar.context.center,
polar.context.insideRadius,
polar.context.outsideRadius,
polar.backgroundColor,
ColorUtil.clearColor32);
}
else
{
UGL.DrawCricle(vh, polar.context.center,
polar.context.outsideRadius,
polar.backgroundColor);
}
2021-11-23 13:20:07 +08:00
}
}
}
}