From 986fe7e575a9fb0259528e393175ab7cbd4764e7 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Wed, 3 Jun 2026 22:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`Tooltip`=E9=80=9A=E8=BF=87`T?= =?UTF-8?q?itleLabelStyle`=E7=9A=84`TextStyle`=E7=9A=84`Alignment`?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A0=87=E9=A2=98=E7=9A=84=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20(#363)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 1 + Runtime/Component/Tooltip/Tooltip.cs | 2 +- Runtime/Component/Tooltip/TooltipView.cs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 8795461a..6e0cadff 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -81,6 +81,7 @@ slug: /changelog ## master +* (2026.06.03) 增加`Tooltip`通过`TitleLabelStyle`的`TextStyle`的`Alignment`设置标题的对齐方式 (#363) * (2026.05.25) 增加`DataZoom`的`filterAxisRange`设置坐标轴的范围计算是否受`DataZoom`的影响 * (2026.05.23) 优化`DataZoom`的`Marquee`框选功能 * (2026.05.23) 修复`DataZoom`内绘制的折线图可能会超出范围的问题 diff --git a/Runtime/Component/Tooltip/Tooltip.cs b/Runtime/Component/Tooltip/Tooltip.cs index e17247b7..c1cb9428 100644 --- a/Runtime/Component/Tooltip/Tooltip.cs +++ b/Runtime/Component/Tooltip/Tooltip.cs @@ -155,7 +155,7 @@ namespace XCharts.Runtime [SerializeField] private List m_ContentLabelStyles = new List() { - new LabelStyle() { textPadding = new TextPadding(0, 5, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleCenter } }, + new LabelStyle() { textPadding = new TextPadding(0, 5, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleLeft } }, new LabelStyle() { textPadding = new TextPadding(0, 20, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleLeft } }, new LabelStyle() { textPadding = new TextPadding(0, 0, 0, 0), textStyle = new TextStyle() { alignment = TextAnchor.MiddleRight } } }; diff --git a/Runtime/Component/Tooltip/TooltipView.cs b/Runtime/Component/Tooltip/TooltipView.cs index 0ae78702..294f3691 100644 --- a/Runtime/Component/Tooltip/TooltipView.cs +++ b/Runtime/Component/Tooltip/TooltipView.cs @@ -260,6 +260,7 @@ namespace XCharts.Runtime view.layout.childControlWidth = false; view.layout.childForceExpandHeight = false; view.layout.childForceExpandWidth = false; + view.layout.childAlignment = tooltip.titleLabelStyle.textStyle.alignment; view.layout.padding = new RectOffset(tooltip.paddingLeftRight, tooltip.paddingLeftRight, tooltip.paddingTopBottom,