From 8c6d013341c5f135812874add228fa17e42f8c5b Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sun, 26 Feb 2023 22:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`DataZoom`=E7=9A=84`startEndF?= =?UTF-8?q?unction`=E5=A7=94=E6=89=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Component/DataZoom/DataZoom.cs | 5 +++++ Runtime/Component/DataZoom/DataZoomHandler.cs | 2 ++ Runtime/Internal/Misc/DelegateFunction.cs | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 4de6548a..c1561784 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -65,6 +65,7 @@ slug: /changelog ## master +* (2023.02.26) 增加`DataZoom`的`startEndFunction`委托 * (2023.02.12) 重构`Component`相关代码,调整API接口 * (2023.02.10) 修复`Axis`在`Log`轴时某些情况下最小值不正确的问题 * (2023.02.10) 优化`Axis`的数值`Label`的默认显示格式 diff --git a/Runtime/Component/DataZoom/DataZoom.cs b/Runtime/Component/DataZoom/DataZoom.cs index 27b82507..84cf83ad 100644 --- a/Runtime/Component/DataZoom/DataZoom.cs +++ b/Runtime/Component/DataZoom/DataZoom.cs @@ -93,6 +93,7 @@ namespace XCharts.Runtime [SerializeField][Since("v3.6.0")] private bool m_EndLock; public DataZoomContext context = new DataZoomContext(); + private CustomDataZoomStartEndFunction m_StartEndFunction; /// /// Whether to show dataZoom. @@ -393,6 +394,10 @@ namespace XCharts.Runtime get { return m_MarqueeStyle; } set { if (PropertyUtil.SetClass(ref m_MarqueeStyle, value)) SetAllDirty(); } } + /// + /// start和end变更委托。 + /// + public CustomDataZoomStartEndFunction startEndFunction { get { return m_StartEndFunction; } set { m_StartEndFunction = value; } } class AxisIndexValueInfo { diff --git a/Runtime/Component/DataZoom/DataZoomHandler.cs b/Runtime/Component/DataZoom/DataZoomHandler.cs index fd06635d..a98cd540 100644 --- a/Runtime/Component/DataZoom/DataZoomHandler.cs +++ b/Runtime/Component/DataZoom/DataZoomHandler.cs @@ -397,6 +397,8 @@ namespace XCharts.Runtime if (end < start) end = start; + if (dataZoom.startEndFunction != null) + dataZoom.startEndFunction(ref start, ref end); if (!dataZoom.startLock) dataZoom.start = start; diff --git a/Runtime/Internal/Misc/DelegateFunction.cs b/Runtime/Internal/Misc/DelegateFunction.cs index 224616bd..15b1e9db 100644 --- a/Runtime/Internal/Misc/DelegateFunction.cs +++ b/Runtime/Internal/Misc/DelegateFunction.cs @@ -22,4 +22,10 @@ namespace XCharts.Runtime /// public delegate float SymbolSizeFunction(List data); public delegate void CustomDrawGaugePointerFunction(VertexHelper vh, int serieIndex, int dataIndex, float currentAngle); + /// + /// DataZoom的start和end变更时的委托方法。 + /// + /// + /// + public delegate void CustomDataZoomStartEndFunction(ref float start, ref float end); } \ No newline at end of file