diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index f8ff05f2..b213f27c 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -66,6 +66,7 @@ slug: /changelog ## master +* (2023.06.30) 增加`PolarCood`的`indicatorLabelOffset`设置指示文本偏移的支持 * (2023.06.30) 修复`Axis`的`IndicatorLabel`的背景颜色可能不正常的问题 * (2023.06.30) 增加`Axis`的`IndicatorLabel`可自定义`color`的支持 * (2023.06.12) 修复`AxisLabel`的`formatterFunction`在数值轴时`value`不对的问题 diff --git a/Editor/MainComponents/PolarCoordEditor.cs b/Editor/MainComponents/PolarCoordEditor.cs index 28d867a6..bb94c951 100644 --- a/Editor/MainComponents/PolarCoordEditor.cs +++ b/Editor/MainComponents/PolarCoordEditor.cs @@ -12,6 +12,7 @@ namespace XCharts.Editor PropertyTwoFiled("m_Center"); PropertyTwoFiled("m_Radius"); PropertyField("m_BackgroundColor"); + PropertyField("m_IndicatorLabelOffset"); --EditorGUI.indentLevel; } } diff --git a/Runtime/Component/Axis/AngleAxis/AngleAxisHandler.cs b/Runtime/Component/Axis/AngleAxis/AngleAxisHandler.cs index 5ac345e7..41d6658f 100644 --- a/Runtime/Component/Axis/AngleAxis/AngleAxisHandler.cs +++ b/Runtime/Component/Axis/AngleAxis/AngleAxisHandler.cs @@ -168,7 +168,7 @@ namespace XCharts.Runtime var dir = (chart.pointerPos - new Vector2(polar.context.center.x, polar.context.center.y)).normalized; var angle = ChartHelper.GetAngle360(Vector2.up, dir); axis.context.pointerValue = (angle - component.context.startAngle + 360) % 360; - axis.context.pointerLabelPosition = polar.context.center + new Vector3(dir.x, dir.y) * (polar.context.outsideRadius + 25); + axis.context.pointerLabelPosition = polar.context.center + new Vector3(dir.x, dir.y) * (polar.context.outsideRadius + polar.indicatorLabelOffset); } } } \ No newline at end of file diff --git a/Runtime/Component/Tooltip/TooltipHandler.cs b/Runtime/Component/Tooltip/TooltipHandler.cs index e60c7278..fc91af75 100644 --- a/Runtime/Component/Tooltip/TooltipHandler.cs +++ b/Runtime/Component/Tooltip/TooltipHandler.cs @@ -57,9 +57,10 @@ namespace XCharts.Runtime if (com is Axis) { var axis = com as Axis; + var aligment = (com is AngleAxis) ? TextAnchor.MiddleCenter : axis.context.aligment; var labelName = ChartCached.GetComponentObjectName(axis); var item = ChartHelper.AddTooltipIndicatorLabel(component, labelName, m_LabelRoot.transform, - chart.theme, axis.context.aligment, axis.indicatorLabel); + chart.theme, aligment, axis.indicatorLabel); item.SetActive(false); m_IndicatorLabels[labelName] = item; }