mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 05:08:48 +00:00
增加UIText扩展组件
This commit is contained in:
@@ -78,6 +78,9 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2024.11.04) 增加`UIText`扩展组件
|
||||||
|
* (2024.12.04) 删除`TextStyle`的无用配置项`tmpAlignment`
|
||||||
|
|
||||||
## v3.12.1
|
## v3.12.1
|
||||||
|
|
||||||
版本要点:
|
版本要点:
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ namespace XCharts.Runtime
|
|||||||
chartText.SetActive(textStyle.show);
|
chartText.SetActive(textStyle.show);
|
||||||
|
|
||||||
RectTransform rect = EnsureComponent<RectTransform>(txtObj);
|
RectTransform rect = EnsureComponent<RectTransform>(txtObj);
|
||||||
rect.localPosition = Vector3.zero;
|
rect.anchoredPosition3D = Vector3.zero;
|
||||||
rect.sizeDelta = sizeDelta;
|
rect.sizeDelta = sizeDelta;
|
||||||
rect.anchorMin = anchorMin;
|
rect.anchorMin = anchorMin;
|
||||||
rect.anchorMax = anchorMax;
|
rect.anchorMax = anchorMax;
|
||||||
@@ -492,7 +492,7 @@ namespace XCharts.Runtime
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateAnchorAndPivotByTextAlignment(TextAnchor alignment, out Vector2 anchorMin, out Vector2 anchorMax,
|
public static void UpdateAnchorAndPivotByTextAlignment(TextAnchor alignment, out Vector2 anchorMin, out Vector2 anchorMax,
|
||||||
out Vector2 pivot)
|
out Vector2 pivot)
|
||||||
{
|
{
|
||||||
switch (alignment)
|
switch (alignment)
|
||||||
|
|||||||
@@ -27,27 +27,27 @@ namespace XCharts.Runtime
|
|||||||
borderWidth, borderColor);
|
borderWidth, borderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InitBackground(UIComponent table)
|
internal static void InitBackground(UIComponent component)
|
||||||
{
|
{
|
||||||
if (table.background.show == false ||
|
if (component.background.show == false ||
|
||||||
(table.background.image == null && ChartHelper.IsClearColor(table.background.imageColor)))
|
(component.background.image == null && ChartHelper.IsClearColor(component.background.imageColor)))
|
||||||
{
|
{
|
||||||
ChartHelper.DestoryGameObject(table.transform, "Background");
|
ChartHelper.DestoryGameObject(component.transform, "Background");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var sizeDelta = table.background.imageWidth > 0 && table.background.imageHeight > 0 ?
|
var sizeDelta = component.background.imageWidth > 0 && component.background.imageHeight > 0 ?
|
||||||
new Vector2(table.background.imageWidth, table.background.imageHeight) :
|
new Vector2(component.background.imageWidth, component.background.imageHeight) :
|
||||||
table.graphSizeDelta;
|
component.graphSizeDelta;
|
||||||
var backgroundObj = ChartHelper.AddObject("Background", table.transform, table.graphMinAnchor,
|
var backgroundObj = ChartHelper.AddObject("Background", component.transform, component.graphMinAnchor,
|
||||||
table.graphMaxAnchor, table.graphPivot, sizeDelta);
|
component.graphMaxAnchor, component.graphPivot, sizeDelta);
|
||||||
backgroundObj.hideFlags = table.chartHideFlags;
|
backgroundObj.hideFlags = component.chartHideFlags;
|
||||||
|
|
||||||
var backgroundImage = ChartHelper.EnsureComponent<Image>(backgroundObj);
|
var backgroundImage = ChartHelper.EnsureComponent<Image>(backgroundObj);
|
||||||
ChartHelper.UpdateRectTransform(backgroundObj, table.graphMinAnchor,
|
ChartHelper.UpdateRectTransform(backgroundObj, component.graphMinAnchor,
|
||||||
table.graphMaxAnchor, table.graphPivot, sizeDelta);
|
component.graphMaxAnchor, component.graphPivot, sizeDelta);
|
||||||
ChartHelper.SetBackground(backgroundImage, table.background);
|
ChartHelper.SetBackground(backgroundImage, component.background);
|
||||||
backgroundObj.transform.SetSiblingIndex(0);
|
backgroundObj.transform.SetSiblingIndex(0);
|
||||||
backgroundObj.SetActive(table.background.show && table.background.image != null);
|
backgroundObj.SetActive(component.background.show && component.background.image != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user