mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 22:10:11 +00:00
修复ChartLabel在TMP下异常报错的问题
This commit is contained in:
@@ -197,7 +197,7 @@ namespace XCharts
|
||||
switch (m_Align)
|
||||
{
|
||||
case Align.Left:
|
||||
switch (m_LabelText.text.alignment)
|
||||
switch (m_LabelText.alignment)
|
||||
{
|
||||
case TextAnchor.LowerLeft:
|
||||
case TextAnchor.UpperLeft:
|
||||
@@ -217,7 +217,7 @@ namespace XCharts
|
||||
}
|
||||
break;
|
||||
case Align.Right:
|
||||
switch (m_LabelText.text.alignment)
|
||||
switch (m_LabelText.alignment)
|
||||
{
|
||||
case TextAnchor.LowerLeft:
|
||||
case TextAnchor.UpperLeft:
|
||||
|
||||
@@ -46,6 +46,36 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public TextAnchor alignment
|
||||
{
|
||||
get
|
||||
{
|
||||
#if dUI_TextMeshPro
|
||||
if (m_TMPText == null) return TextAnchor.MiddleCenter;
|
||||
switch (m_TMPText.alignment)
|
||||
{
|
||||
case TextAlignmentOptions.Bottom: return TextAnchor.LowerCenter;
|
||||
case TextAlignmentOptions.BottomLeft: return TextAnchor.LowerLeft;
|
||||
case TextAlignmentOptions.BottomRight: return TextAnchor.LowerRight;
|
||||
case TextAlignmentOptions.Center: return TextAnchor.MiddleCenter;
|
||||
case TextAlignmentOptions.Left: return TextAnchor.MiddleLeft;
|
||||
case TextAlignmentOptions.Right: return TextAnchor.MiddleRight;
|
||||
case TextAlignmentOptions.Top: return TextAnchor.UpperCenter;
|
||||
case TextAlignmentOptions.TopLeft: return TextAnchor.UpperLeft;
|
||||
case TextAlignmentOptions.TopRight: return TextAnchor.UpperRight;
|
||||
default: return TextAnchor.MiddleCenter;
|
||||
}
|
||||
#else
|
||||
if (m_Text != null) return m_Text.alignment;
|
||||
else return TextAnchor.MiddleCenter;
|
||||
#endif
|
||||
}
|
||||
set
|
||||
{
|
||||
SetAlignment(alignment);
|
||||
}
|
||||
}
|
||||
|
||||
public ChartText()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user