mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
增加Chart的onSerieClick,onSerieDown,onSerieEnter和onSerieExit回调
This commit is contained in:
33
Runtime/Internal/Pools/SerieEventDataPool.cs
Normal file
33
Runtime/Internal/Pools/SerieEventDataPool.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
public static class SerieEventDataPool
|
||||
{
|
||||
private static readonly ObjectPool<SerieEventData> s_ListPool = new ObjectPool<SerieEventData>(null, OnClear);
|
||||
|
||||
static void OnGet(SerieEventData data)
|
||||
{
|
||||
}
|
||||
|
||||
static void OnClear(SerieEventData data)
|
||||
{
|
||||
data.Reset();
|
||||
}
|
||||
|
||||
public static SerieEventData Get(Vector3 pos, int serieIndex, int dataIndex, int dimension, double value)
|
||||
{
|
||||
var data = s_ListPool.Get();
|
||||
data.serieIndex = serieIndex;
|
||||
data.dataIndex = dataIndex;
|
||||
data.pointerPos = pos;
|
||||
data.dimension = dimension;
|
||||
return data;
|
||||
}
|
||||
|
||||
public static void Release(SerieEventData toRelease)
|
||||
{
|
||||
s_ListPool.Release(toRelease);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user