mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 00:20:18 +00:00
完善Pie饼图的交互动画效果
This commit is contained in:
@@ -538,7 +538,8 @@ namespace XCharts.Runtime
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float GetInteractionRadius(float radius){
|
||||
public float GetInteractionRadius(float radius)
|
||||
{
|
||||
|
||||
if (m_Enable && m_Interaction.enable)
|
||||
return m_Interaction.GetRadius(radius);
|
||||
@@ -550,5 +551,15 @@ namespace XCharts.Runtime
|
||||
{
|
||||
return enable && m_FadeOut.context.end;
|
||||
}
|
||||
|
||||
public bool IsFadeIn()
|
||||
{
|
||||
return enable && m_FadeIn.context.start;
|
||||
}
|
||||
|
||||
public bool IsFadeOut()
|
||||
{
|
||||
return enable && m_FadeOut.context.start;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,11 @@ namespace XCharts.Runtime
|
||||
|
||||
public void SetValue(ref bool needInteract, float size)
|
||||
{
|
||||
if (m_TargetValue != size)
|
||||
if (m_PreviousValue == float.NaN)
|
||||
{
|
||||
m_PreviousValue = size;
|
||||
}
|
||||
else if (m_TargetValue != size)
|
||||
{
|
||||
needInteract = true;
|
||||
m_UpdateFlag = true;
|
||||
@@ -100,7 +104,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!IsValueEnable() || m_PreviousValue == 0 || animationDuration == 0)
|
||||
return false;
|
||||
if (m_UpdateFlag)
|
||||
if (float.IsNaN(m_TargetValue))
|
||||
return false;
|
||||
if (m_UpdateFlag && !float.IsNaN(m_PreviousValue))
|
||||
{
|
||||
var time = Time.time - m_UpdateTime;
|
||||
var total = animationDuration / 1000;
|
||||
@@ -176,7 +182,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!IsValueEnable() || animationDuration == 0)
|
||||
return false;
|
||||
if (m_UpdateFlag)
|
||||
if (float.IsNaN(m_TargetValue))
|
||||
return false;
|
||||
if (m_UpdateFlag && !float.IsNaN(m_PreviousValue))
|
||||
{
|
||||
var time = Time.time - m_UpdateTime;
|
||||
var total = animationDuration / 1000;
|
||||
@@ -205,6 +213,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
m_UpdateFlag = false;
|
||||
m_ValueEnable = false;
|
||||
m_TargetValue = float.NaN;
|
||||
m_PreviousValue = float.NaN;
|
||||
m_TargetColor = ColorUtil.clearColor32;
|
||||
m_TargetToColor = ColorUtil.clearColor32;
|
||||
|
||||
@@ -343,7 +343,8 @@ namespace XCharts.Runtime
|
||||
var color = ColorUtil.clearColor32;
|
||||
var toColor = ColorUtil.clearColor32;
|
||||
var interactDuration = serie.animation.GetInteractionDuration();
|
||||
var interactEnable = serie.animation.enable && serie.animation.interaction.enable;
|
||||
var interactEnable = serie.animation.enable && serie.animation.interaction.enable
|
||||
&& !serie.animation.IsFadeIn() && !serie.animation.IsFadeOut();
|
||||
var data = serie.data;
|
||||
serie.animation.InitProgress(0, 360);
|
||||
for (int n = 0; n < data.Count; n++)
|
||||
|
||||
Reference in New Issue
Block a user