From b1522a27d4120cb8c1b06042a8ac5cca0965d889 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 22 Apr 2024 22:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`DataZoom`=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E8=BD=B4=E6=97=B6=E7=9A=84`GridCoord`?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8F=AF=E8=83=BD=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#317)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Internal/BaseChart.Component.cs | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 650b60aa..97e89f85 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -73,6 +73,7 @@ slug: /changelog ## master +* (2024.04.22) 修复`DataZoom`控制多个轴时的`GridCoord`获取可能不正确的问题 (#317) * (2024.04.22) 增加`GridCoord3D`3D坐标系 * (2024.04.15) 优化`DateTimeUtil`时间戳转`DateTime`接口时区的问题 * (2024.04.15) 优化`GridCoord`在开启`GridLayout`时也显示`Left` `Right` `Top` `Bottom`参数 (#316) diff --git a/Runtime/Internal/BaseChart.Component.cs b/Runtime/Internal/BaseChart.Component.cs index dee1a5d7..32de3739 100644 --- a/Runtime/Internal/BaseChart.Component.cs +++ b/Runtime/Internal/BaseChart.Component.cs @@ -317,13 +317,29 @@ namespace XCharts.Runtime GridCoord grid = null; if (dataZoom.xAxisIndexs != null && dataZoom.xAxisIndexs.Count > 0) { - var xAxis = GetChartComponent(dataZoom.xAxisIndexs[0]); - grid = GetChartComponent(xAxis.gridIndex); + for (int i = 0; i < dataZoom.xAxisIndexs.Count; i++) + { + var xAxis = GetChartComponent(dataZoom.xAxisIndexs[i]); + var tempGrid = GetChartComponent(xAxis.gridIndex); + if (tempGrid.IsPointerEnter()) + { + grid = tempGrid; + break; + } + } } else if (dataZoom.yAxisIndexs != null && dataZoom.yAxisIndexs.Count > 0) { - var yAxis = GetChartComponent(dataZoom.yAxisIndexs[0]); - grid = GetChartComponent(yAxis.gridIndex); + for (int i = 0; i < dataZoom.yAxisIndexs.Count; i++) + { + var yAxis = GetChartComponent(dataZoom.yAxisIndexs[i]); + var tempGrid = GetChartComponent(yAxis.gridIndex); + if (tempGrid.IsPointerEnter()) + { + grid = tempGrid; + break; + } + } } if (grid == null) return GetChartComponent(); else return grid;