Skip to content

Commit

Permalink
修复TextLimit在开启TextMeshPro后无效的问题 (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
monitor1394 committed Jan 27, 2024
1 parent d93f783 commit c987cb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Documentation~/zh/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ slug: /changelog

## master

* (2024.01.27) 修复`TextLimit`在开启`TextMeshPro`后无效的问题 (#301)
* (2024.01.24) 增加`Bar`支持X轴和Y轴都为`Category`类目轴
* (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名
* (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴
Expand Down
7 changes: 5 additions & 2 deletions Runtime/Internal/Object/ChartText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,12 @@ public void SetFontAndSizeAndStyle(TextStyle textStyle, ComponentTheme theme)
public float GetPreferredWidth(string content)
{
#if dUI_TextMeshPro
if (m_TMPText != null) return 0; // TODO:
if (m_TMPText != null && !string.IsNullOrEmpty(content))
{
return m_TMPText.GetPreferredValues(content).x;
}
#else
if (m_Text != null)
if (m_Text != null && !string.IsNullOrEmpty(content))
{
var tg = m_Text.cachedTextGeneratorForLayout;
var setting = m_Text.GetGenerationSettings(Vector2.zero);
Expand Down

0 comments on commit c987cb1

Please sign in to comment.