[feature][serie] support EmphasisStle,BlurStyle and SelectStyle

This commit is contained in:
monitor1394
2022-07-25 07:46:03 +08:00
parent 8dde322c04
commit 4f93628667
61 changed files with 1052 additions and 758 deletions

View File

@@ -544,17 +544,25 @@ namespace XCharts.Runtime
return theme.GetBackgroundColor(background);
}
public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)
public Color32 GetItemColor(Serie serie, SerieData serieData)
{
var colorIndex = serieData == null || !serie.useDataNameForColor ?
GetLegendRealShowNameIndex(serie.legendName) :
GetLegendRealShowNameIndex(serieData.legendName);
return SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
Color32 color, toColor;
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme);
return color;
}
public Color32 GetItemColor(Serie serie, bool highlight = false)
public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)
{
return SerieHelper.GetItemColor(serie, null, m_Theme, serie.context.colorIndex, highlight);
Color32 color, toColor;
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme, colorIndex);
return color;
}
public Color32 GetItemColor(Serie serie)
{
Color32 color, toColor;
SerieHelper.GetItemColor(out color, out toColor, serie, null, m_Theme);
return color;
}
}
}

View File

@@ -27,6 +27,28 @@ namespace XCharts.Runtime
public SerieHandler handler { get; set; }
public static void ClearVerticesDirty(ChildComponent component)
{
if (component != null)
component.ClearVerticesDirty();
}
public static void ClearComponentDirty(ChildComponent component)
{
if (component != null)
component.ClearComponentDirty();
}
public static bool IsVertsDirty(ChildComponent component)
{
return component == null?false : component.vertsDirty;
}
public static bool IsComponentDirty(ChildComponent component)
{
return component == null?false : component.componentDirty;
}
public virtual void SetVerticesDirty()
{
m_VertsDirty = true;
@@ -47,8 +69,7 @@ namespace XCharts.Runtime
m_ComponentDirty = false;
}
public virtual void ClearData()
{ }
public virtual void ClearData() { }
public virtual void ClearDirty()
{
@@ -68,11 +89,9 @@ namespace XCharts.Runtime
handler.RemoveComponent();
}
public virtual void OnDataUpdate()
{ }
public virtual void OnDataUpdate() { }
public virtual void OnBeforeSerialize()
{ }
public virtual void OnBeforeSerialize() { }
public virtual void OnAfterDeserialize()
{

View File

@@ -28,6 +28,28 @@ namespace XCharts.Runtime
public Action refreshComponent { get; set; }
public GameObject gameObject { get; set; }
public static void ClearVerticesDirty(ChildComponent component)
{
if (component != null)
component.ClearVerticesDirty();
}
public static void ClearComponentDirty(ChildComponent component)
{
if (component != null)
component.ClearComponentDirty();
}
public static bool IsVertsDirty(ChildComponent component)
{
return component == null?false : component.vertsDirty;
}
public static bool IsComponentDirty(ChildComponent component)
{
return component == null?false : component.componentDirty;
}
public virtual void SetVerticesDirty()
{
m_VertsDirty = true;

View File

@@ -845,6 +845,22 @@ namespace XCharts.Runtime
return newColor;
}
public static Color32 GetBlurColor(Color32 color, float a = 0.3f)
{
var newColor = color;
newColor.a = (byte) (a * 255);
return newColor;
}
public static Color32 GetSelectColor(Color32 color, float rate = 0.7f)
{
var newColor = color;
newColor.r = (byte) (color.r * rate);
newColor.g = (byte) (color.g * rate);
newColor.b = (byte) (color.b * rate);
return newColor;
}
public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)
{
Vector3 v0 = Vector3.Cross(A - D, P - D);