mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 12:48:47 +00:00
[optimaze][background] rename hideThemeBackgroundColor to autoColor
This commit is contained in:
@@ -53,6 +53,8 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2022.06.14) 优化`Background`,参数`hideThemeBackgroundColor`重命名为`autoColor`
|
||||||
|
* (2022.06.10) 增加`Legend`的`AxisLabel`支持`autoColor`
|
||||||
* (2022.06.08) 修复`Axis`的`AxisLabel`在设置不显示时还显示首尾两个`label`的问题
|
* (2022.06.08) 修复`Axis`的`AxisLabel`在设置不显示时还显示首尾两个`label`的问题
|
||||||
|
|
||||||
## v3.0.0
|
## v3.0.0
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace XCharts.Editor
|
|||||||
PropertyField("m_Image");
|
PropertyField("m_Image");
|
||||||
PropertyField("m_ImageType");
|
PropertyField("m_ImageType");
|
||||||
PropertyField("m_ImageColor");
|
PropertyField("m_ImageColor");
|
||||||
PropertyField("m_HideThemeBackgroundColor");
|
PropertyField("m_AutoColor");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace XCharts.Runtime
|
|||||||
[SerializeField] private Sprite m_Image;
|
[SerializeField] private Sprite m_Image;
|
||||||
[SerializeField] private Image.Type m_ImageType;
|
[SerializeField] private Image.Type m_ImageType;
|
||||||
[SerializeField] private Color m_ImageColor = Color.white;
|
[SerializeField] private Color m_ImageColor = Color.white;
|
||||||
[SerializeField] private bool m_HideThemeBackgroundColor = true;
|
[SerializeField] private bool m_AutoColor = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to enable the background component.
|
/// Whether to enable the background component.
|
||||||
@@ -59,13 +59,13 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to hide the background color set in the theme when the background component is on.
|
/// Whether to use theme background color for component color when the background component is on.
|
||||||
/// |当background组件开启时,是否隐藏主题中设置的背景色。
|
/// |当background组件开启时,是否自动使用主题背景色作为backgrounnd组件的颜色。当设置为false时,用imageColor作为颜色。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool hideThemeBackgroundColor
|
public bool autoColor
|
||||||
{
|
{
|
||||||
get { return m_HideThemeBackgroundColor; }
|
get { return m_AutoColor; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_HideThemeBackgroundColor, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetDefaultValue()
|
public override void SetDefaultValue()
|
||||||
@@ -74,7 +74,7 @@ namespace XCharts.Runtime
|
|||||||
m_Image = null;
|
m_Image = null;
|
||||||
m_ImageType = Image.Type.Sliced;
|
m_ImageType = Image.Type.Sliced;
|
||||||
m_ImageColor = Color.white;
|
m_ImageColor = Color.white;
|
||||||
m_HideThemeBackgroundColor = true;
|
m_AutoColor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace XCharts.Runtime
|
|||||||
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||||
backgroundImage.sprite = component.image;
|
backgroundImage.sprite = component.image;
|
||||||
backgroundImage.type = component.imageType;
|
backgroundImage.type = component.imageType;
|
||||||
backgroundImage.color = component.imageColor;
|
backgroundImage.color = chart.theme.GetBackgroundColor(component);
|
||||||
|
|
||||||
backgroundObj.transform.SetSiblingIndex(0);
|
backgroundObj.transform.SetSiblingIndex(0);
|
||||||
backgroundObj.SetActive(component.show);
|
backgroundObj.SetActive(component.show);
|
||||||
@@ -32,10 +32,18 @@ namespace XCharts.Runtime
|
|||||||
component.refreshComponent();
|
component.refreshComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Update()
|
||||||
|
{
|
||||||
|
if (component.gameObject != null && component.gameObject.transform.GetSiblingIndex() != 0)
|
||||||
|
component.gameObject.transform.SetSiblingIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
public override void DrawBase(VertexHelper vh)
|
public override void DrawBase(VertexHelper vh)
|
||||||
{
|
{
|
||||||
if (!component.show)
|
if (!component.show)
|
||||||
return;
|
return;
|
||||||
|
if (component.image != null)
|
||||||
|
return;
|
||||||
|
|
||||||
var p1 = new Vector3(chart.chartX, chart.chartY + chart.chartHeight);
|
var p1 = new Vector3(chart.chartX, chart.chartY + chart.chartHeight);
|
||||||
var p2 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY + chart.chartHeight);
|
var p2 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY + chart.chartHeight);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public Color32 GetBackgroundColor(Background background)
|
public Color32 GetBackgroundColor(Background background)
|
||||||
{
|
{
|
||||||
if (background != null && background.show && background.hideThemeBackgroundColor)
|
if (background != null && background.show && !background.autoColor)
|
||||||
return background.imageColor;
|
return background.imageColor;
|
||||||
else
|
else
|
||||||
return backgroundColor;
|
return backgroundColor;
|
||||||
|
|||||||
Reference in New Issue
Block a user