mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
增加IconStyle的autoHideWhenLabelEmpty参数设置当label为空时是否自动隐藏图标
This commit is contained in:
@@ -400,7 +400,7 @@ namespace XCharts
|
||||
}
|
||||
|
||||
public static ChartLabel AddAxisLabelObject(int index, string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax,
|
||||
Vector2 pivot, Vector2 sizeDelta, Axis axis, ComponentTheme theme, string content, bool autoHideWhenContentEmpty = false)
|
||||
Vector2 pivot, Vector2 sizeDelta, Axis axis, ComponentTheme theme, string content)
|
||||
{
|
||||
var textStyle = axis.axisLabel.textStyle;
|
||||
var iconStyle = axis.iconStyle;
|
||||
@@ -414,10 +414,6 @@ namespace XCharts
|
||||
GameObject.DestroyImmediate(oldText);
|
||||
}
|
||||
var labelShow = axis.axisLabel.show && (axis.axisLabel.interval == 0 || index % (axis.axisLabel.interval + 1) == 0);
|
||||
if (autoHideWhenContentEmpty && string.IsNullOrEmpty(content))
|
||||
{
|
||||
labelShow &= false;
|
||||
}
|
||||
label.label = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme);
|
||||
label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, iconStyle.width, iconStyle.height);
|
||||
label.SetAutoSize(false);
|
||||
|
||||
Reference in New Issue
Block a user