修复Tooltip移出坐标系后还显示的问题

This commit is contained in:
monitor1394
2024-03-11 08:00:40 +08:00
parent b4cb62241f
commit 757ccb04fb
2 changed files with 16 additions and 16 deletions

View File

@@ -73,6 +73,7 @@ slug: /changelog
## master ## master
* (2024.03.11) 修复`Legend``formatter`在设置`{d}`通配符时显示可能不匹配的问题 (#304) * (2024.03.11) 修复`Legend``formatter`在设置`{d}`通配符时显示可能不匹配的问题 (#304)
* (2024.03.11) 修复`Tooltip`移出坐标系后还显示的问题
* (2024.03.08) 修复`Tooltip``title`从旧版本升级后可能不显示的问题 * (2024.03.08) 修复`Tooltip``title`从旧版本升级后可能不显示的问题
## v3.10.1 ## v3.10.1

View File

@@ -95,30 +95,29 @@ namespace XCharts.Runtime
{ {
showTooltip = false; showTooltip = false;
if (tooltip.trigger == Tooltip.Trigger.None) return; if (tooltip.trigger == Tooltip.Trigger.None) return;
if (!chart.isPointerInChart || !tooltip.show) if (chart.isPointerInChart && tooltip.show)
{ {
if (tooltip.IsActive()) for (int i = chart.series.Count - 1; i >= 0; i--)
{ {
tooltip.ClearValue(); var serie = chart.series[i];
tooltip.SetActive(false); if (!(serie is INeedSerieContainer))
{
showTooltip = true;
containerSeries = null;
return;
}
} }
return; containerSeries = ListPool<Serie>.Get();
} UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref containerSeries);
for (int i = chart.series.Count - 1; i >= 0; i--) if (containerSeries.Count > 0)
{
var serie = chart.series[i];
if (!(serie is INeedSerieContainer))
{ {
showTooltip = true; showTooltip = true;
containerSeries = null;
return;
} }
} }
containerSeries = ListPool<Serie>.Get(); if (!showTooltip && tooltip.IsActive())
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref containerSeries);
if (containerSeries.Count > 0)
{ {
showTooltip = true; tooltip.ClearValue();
tooltip.SetActive(false);
} }
} }