mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
代码优化
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user