mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 18:00:26 +00:00
修复ChartLabel在TMP下异常报错的问题
This commit is contained in:
@@ -197,7 +197,7 @@ namespace XCharts
|
|||||||
switch (m_Align)
|
switch (m_Align)
|
||||||
{
|
{
|
||||||
case Align.Left:
|
case Align.Left:
|
||||||
switch (m_LabelText.text.alignment)
|
switch (m_LabelText.alignment)
|
||||||
{
|
{
|
||||||
case TextAnchor.LowerLeft:
|
case TextAnchor.LowerLeft:
|
||||||
case TextAnchor.UpperLeft:
|
case TextAnchor.UpperLeft:
|
||||||
@@ -217,7 +217,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Align.Right:
|
case Align.Right:
|
||||||
switch (m_LabelText.text.alignment)
|
switch (m_LabelText.alignment)
|
||||||
{
|
{
|
||||||
case TextAnchor.LowerLeft:
|
case TextAnchor.LowerLeft:
|
||||||
case TextAnchor.UpperLeft:
|
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()
|
public ChartText()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user