代码优化

This commit is contained in:
monitor1394
2023-12-14 10:20:48 +08:00
parent 922a944881
commit 63173cdce6
2 changed files with 9 additions and 6 deletions

View File

@@ -110,6 +110,7 @@ namespace XCharts.Runtime
if (!(serie is INeedSerieContainer))
{
showTooltip = true;
containerSeries = null;
return;
}
}
@@ -126,6 +127,7 @@ namespace XCharts.Runtime
private void UpdateTooltip(Tooltip tooltip)
{
if (!showTooltip) return;
var anyTrigger = false;
for (int i = chart.series.Count - 1; i >= 0; i--)
{
var serie = chart.series[i];
@@ -133,20 +135,21 @@ namespace XCharts.Runtime
{
if (SetSerieTooltip(tooltip, serie))
{
anyTrigger = true;
chart.RefreshTopPainter();
return;
break;
}
}
}
if (containerSeries != null)
{
if (!SetSerieTooltip(tooltip, containerSeries))
{
showTooltip = false;
}
else
anyTrigger = true;
ListPool<Serie>.Release(containerSeries);
}
if (!showTooltip)
if (!showTooltip || !anyTrigger)
{
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
{

View File

@@ -606,7 +606,7 @@ namespace XCharts.Runtime
innerFill = stateStyle.areaStyle.innerFill;
toTop = stateStyle.areaStyle.toTop;
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
GetColor(ref color, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
GetColor(ref toColor, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
}
else
{
@@ -645,7 +645,7 @@ namespace XCharts.Runtime
}
}
private static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
public static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
{
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;