From b27f0ec6ec30d176d7b8693c542905222c6d4d19 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Wed, 19 Jul 2023 13:23:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84`Pie`=E9=A5=BC=E5=9B=BE?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E4=BA=92=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Component/Animation/AnimationStyle.cs | 13 ++++++++++++- Runtime/Component/Interaction/InteractData.cs | 15 ++++++++++++--- Runtime/Serie/Pie/PieHandler.cs | 3 ++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Runtime/Component/Animation/AnimationStyle.cs b/Runtime/Component/Animation/AnimationStyle.cs index d217c084..b0c908e2 100644 --- a/Runtime/Component/Animation/AnimationStyle.cs +++ b/Runtime/Component/Animation/AnimationStyle.cs @@ -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; + } } } \ No newline at end of file diff --git a/Runtime/Component/Interaction/InteractData.cs b/Runtime/Component/Interaction/InteractData.cs index 2d42836a..4fa47d1f 100644 --- a/Runtime/Component/Interaction/InteractData.cs +++ b/Runtime/Component/Interaction/InteractData.cs @@ -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; diff --git a/Runtime/Serie/Pie/PieHandler.cs b/Runtime/Serie/Pie/PieHandler.cs index 8ca4e72c..27ba1b52 100644 --- a/Runtime/Serie/Pie/PieHandler.cs +++ b/Runtime/Serie/Pie/PieHandler.cs @@ -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++)