mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
v3.0.0-preivew8
This commit is contained in:
@@ -5,17 +5,26 @@ using UnityEngine.UI;
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class IconStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
public class IconStyle : ChildComponent
|
||||
{
|
||||
public enum Layer
|
||||
{
|
||||
UnderLabel,
|
||||
AboveLabel
|
||||
/// <summary>
|
||||
/// The icon is display under the label text.
|
||||
/// 图标在标签文字下
|
||||
/// </summary>
|
||||
UnderText,
|
||||
/// <summary>
|
||||
/// The icon is display above the label text.
|
||||
/// 图标在标签文字上
|
||||
/// </summary>
|
||||
AboveText
|
||||
}
|
||||
[SerializeField] private bool m_Show = false;
|
||||
[SerializeField] private Layer m_Layer;
|
||||
[SerializeField] private Align m_Align = Align.Left;
|
||||
[SerializeField] private Sprite m_Sprite;
|
||||
[SerializeField] private Image.Type m_Type;
|
||||
[SerializeField] private Color m_Color = Color.white;
|
||||
[SerializeField] private float m_Width = 20;
|
||||
[SerializeField] private float m_Height = 20;
|
||||
@@ -25,7 +34,7 @@ namespace XCharts.Runtime
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Layer = Layer.UnderLabel;
|
||||
m_Layer = Layer.UnderText;
|
||||
m_Sprite = null;
|
||||
m_Color = Color.white;
|
||||
m_Width = 20;
|
||||
@@ -48,6 +57,11 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
|
||||
/// <summary>
|
||||
/// How to display the icon.
|
||||
/// |图片的显示类型。
|
||||
/// </summary>
|
||||
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// 图标颜色。
|
||||
/// </summary>
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
@@ -77,6 +91,7 @@ namespace XCharts.Runtime
|
||||
iconStyle.show = show;
|
||||
iconStyle.layer = layer;
|
||||
iconStyle.sprite = sprite;
|
||||
iconStyle.type = type;
|
||||
iconStyle.color = color;
|
||||
iconStyle.width = width;
|
||||
iconStyle.height = height;
|
||||
@@ -91,6 +106,7 @@ namespace XCharts.Runtime
|
||||
show = iconStyle.show;
|
||||
layer = iconStyle.layer;
|
||||
sprite = iconStyle.sprite;
|
||||
type = iconStyle.type;
|
||||
color = iconStyle.color;
|
||||
width = iconStyle.width;
|
||||
height = iconStyle.height;
|
||||
|
||||
82
Runtime/Component/Child/ImageStyle.cs
Normal file
82
Runtime/Component/Child/ImageStyle.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Sprite m_Sprite;
|
||||
[SerializeField] private Image.Type m_Type;
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
[SerializeField] private Color m_Color = Color.clear;
|
||||
[SerializeField] private float m_Width = 0;
|
||||
[SerializeField] private float m_Height = 0;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Type = Image.Type.Simple;
|
||||
m_Sprite = null;
|
||||
m_AutoColor = false;
|
||||
m_Color = Color.white;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the data icon is show.
|
||||
/// |是否显示图标。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// The image of icon.
|
||||
/// |图标的图片。
|
||||
/// </summary>
|
||||
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
|
||||
/// <summary>
|
||||
/// How to display the image.
|
||||
/// |图片的显示类型。
|
||||
/// </summary>
|
||||
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// 是否自动颜色。
|
||||
/// </summary>
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
/// <summary>
|
||||
/// 图标颜色。
|
||||
/// </summary>
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
/// <summary>
|
||||
/// 图标宽。
|
||||
/// </summary>
|
||||
public float width { get { return m_Width; } set { m_Width = value; } }
|
||||
/// <summary>
|
||||
/// 图标高。
|
||||
/// </summary>
|
||||
public float height { get { return m_Height; } set { m_Height = value; } }
|
||||
public ImageStyle Clone()
|
||||
{
|
||||
var imageStyle = new ImageStyle();
|
||||
imageStyle.type = type;
|
||||
imageStyle.sprite = sprite;
|
||||
imageStyle.autoColor = autoColor;
|
||||
imageStyle.color = color;
|
||||
imageStyle.width = width;
|
||||
imageStyle.height = height;
|
||||
return imageStyle;
|
||||
}
|
||||
|
||||
public void Copy(ImageStyle imageStyle)
|
||||
{
|
||||
type = imageStyle.type;
|
||||
sprite = imageStyle.sprite;
|
||||
autoColor = imageStyle.autoColor;
|
||||
color = imageStyle.color;
|
||||
width = imageStyle.width;
|
||||
height = imageStyle.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/ImageStyle.cs.meta
Normal file
11
Runtime/Component/Child/ImageStyle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a76d1129783c4f55b0773da2eda9b67
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,6 +15,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public enum Position
|
||||
{
|
||||
Default,
|
||||
/// <summary>
|
||||
/// Outside of sectors of pie chart, which relates to corresponding sector through visual guide line.
|
||||
/// |饼图扇区外侧,通过视觉引导线连到相应的扇区。
|
||||
@@ -68,32 +69,31 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Outside;
|
||||
[SerializeField] Position m_Position = Position.Default;
|
||||
[SerializeField] protected bool m_AutoOffset = false;
|
||||
[SerializeField] protected Vector3 m_Offset;
|
||||
[SerializeField] protected float m_Rotate;
|
||||
[SerializeField] protected float m_Distance;
|
||||
[SerializeField] protected string m_Formatter;
|
||||
[SerializeField] protected float m_PaddingLeftRight = 2f;
|
||||
[SerializeField] protected float m_PaddingTopBottom = 2f;
|
||||
[SerializeField] protected float m_BackgroundWidth = 0;
|
||||
[SerializeField] protected float m_BackgroundHeight = 0;
|
||||
[SerializeField] protected string m_NumericFormatter = "";
|
||||
[SerializeField] protected bool m_AutoOffset = false;
|
||||
|
||||
[SerializeField] protected float m_Width = 0;
|
||||
[SerializeField] protected float m_Height = 0;
|
||||
|
||||
[SerializeField] protected IconStyle m_Icon = new IconStyle();
|
||||
[SerializeField] protected ImageStyle m_Background = new ImageStyle();
|
||||
[SerializeField] protected TextPadding m_TextPadding = new TextPadding();
|
||||
[SerializeField] protected TextStyle m_TextStyle = new TextStyle();
|
||||
protected SerieLabelFormatterFunction m_FormatterFunction;
|
||||
protected LabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Position = Position.Outside;
|
||||
m_Position = Position.Default;
|
||||
m_Offset = Vector3.zero;
|
||||
m_Distance = 0;
|
||||
m_Rotate = 0;
|
||||
m_PaddingLeftRight = 2f;
|
||||
m_PaddingTopBottom = 2f;
|
||||
m_BackgroundWidth = 0;
|
||||
m_BackgroundHeight = 0;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
m_NumericFormatter = "";
|
||||
m_AutoOffset = false;
|
||||
}
|
||||
@@ -161,42 +161,33 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of background. If set as default value 0, it means than the background width auto set as the text width.
|
||||
/// |标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
|
||||
/// the width of label. If set as default value 0, it means than the label width auto set as the text width.
|
||||
/// |标签的宽度。一般不用指定,不指定时则自动是文字的宽度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float backgroundWidth
|
||||
public float width
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetComponentDirty(); }
|
||||
get { return m_Width; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the height of background. If set as default value 0, it means than the background height auto set as the text height.
|
||||
/// |标签的背景高度。一般不用指定,不指定时则自动是文字的高度。
|
||||
/// the height of label. If set as default value 0, it means than the label height auto set as the text height.
|
||||
/// |标签的高度。一般不用指定,不指定时则自动是文字的高度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float backgroundHeight
|
||||
public float height
|
||||
{
|
||||
get { return m_BackgroundHeight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundHeight, value)) SetComponentDirty(); }
|
||||
get { return m_Height; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the text padding of left and right. defaut:2.
|
||||
/// |左右边距。
|
||||
/// the text padding of label.
|
||||
/// |文本的边距。
|
||||
/// </summary>
|
||||
public float paddingLeftRight
|
||||
public TextPadding textPadding
|
||||
{
|
||||
get { return m_PaddingLeftRight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_PaddingLeftRight, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the text padding of top and bottom. defaut:2.
|
||||
/// |上下边距。
|
||||
/// </summary>
|
||||
public float paddingTopBottom
|
||||
{
|
||||
get { return m_PaddingTopBottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_PaddingTopBottom, value)) SetComponentDirty(); }
|
||||
get { return m_TextPadding; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextPadding, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Standard numeric format strings.
|
||||
@@ -218,8 +209,24 @@ namespace XCharts.Runtime
|
||||
get { return m_AutoOffset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoOffset, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the sytle of background.
|
||||
/// |背景图样式。
|
||||
/// </summary>
|
||||
public ImageStyle background
|
||||
{
|
||||
get { return m_Background; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Background, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of icon.
|
||||
/// |图标样式。
|
||||
/// </summary>
|
||||
public IconStyle icon
|
||||
{
|
||||
get { return m_Icon; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Icon, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of text.
|
||||
/// |文本样式。
|
||||
@@ -229,8 +236,7 @@ namespace XCharts.Runtime
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public SerieLabelFormatterFunction formatterFunction
|
||||
public LabelFormatterFunction formatterFunction
|
||||
{
|
||||
get { return m_FormatterFunction; }
|
||||
set { m_FormatterFunction = value; }
|
||||
@@ -241,6 +247,11 @@ namespace XCharts.Runtime
|
||||
return position == Position.Inside || position == Position.Center;
|
||||
}
|
||||
|
||||
public bool IsAutoSize()
|
||||
{
|
||||
return width == 0 && height == 0;
|
||||
}
|
||||
|
||||
public Vector3 GetOffset(float radius)
|
||||
{
|
||||
var x = ChartHelper.GetActualValue(m_Offset.x, radius);
|
||||
@@ -261,29 +272,42 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public TextAnchor GetAutoAlignment()
|
||||
public virtual LabelStyle Clone()
|
||||
{
|
||||
if (textStyle.autoAlign) return textStyle.alignment;
|
||||
else
|
||||
{
|
||||
switch (position)
|
||||
{
|
||||
case LabelStyle.Position.Inside:
|
||||
case LabelStyle.Position.Center:
|
||||
case LabelStyle.Position.Top:
|
||||
case LabelStyle.Position.Bottom:
|
||||
return TextAnchor.MiddleCenter;
|
||||
case LabelStyle.Position.Outside:
|
||||
case LabelStyle.Position.Right:
|
||||
return TextAnchor.MiddleLeft;
|
||||
case LabelStyle.Position.Left:
|
||||
return TextAnchor.MiddleRight;
|
||||
default:
|
||||
return TextAnchor.MiddleCenter;
|
||||
}
|
||||
}
|
||||
var label = new LabelStyle();
|
||||
label.m_Show = m_Show;
|
||||
label.m_Position = m_Position;
|
||||
label.m_Offset = m_Offset;
|
||||
label.m_Rotate = m_Rotate;
|
||||
label.m_Distance = m_Distance;
|
||||
label.m_Formatter = m_Formatter;
|
||||
label.m_Width = m_Width;
|
||||
label.m_Height = m_Height;
|
||||
label.m_NumericFormatter = m_NumericFormatter;
|
||||
label.m_AutoOffset = m_AutoOffset;
|
||||
label.m_Icon.Copy(m_Icon);
|
||||
label.m_Background.Copy(m_Background);
|
||||
label.m_TextPadding = m_TextPadding;
|
||||
label.m_TextStyle.Copy(m_TextStyle);
|
||||
return label;
|
||||
}
|
||||
|
||||
public virtual void Copy(LabelStyle label)
|
||||
{
|
||||
m_Show = label.m_Show;
|
||||
m_Position = label.m_Position;
|
||||
m_Offset = label.m_Offset;
|
||||
m_Rotate = label.m_Rotate;
|
||||
m_Distance = label.m_Distance;
|
||||
m_Formatter = label.m_Formatter;
|
||||
m_Width = label.m_Width;
|
||||
m_Height = label.m_Height;
|
||||
m_NumericFormatter = label.m_NumericFormatter;
|
||||
m_AutoOffset = label.m_AutoOffset;
|
||||
m_Icon.Copy(label.m_Icon);
|
||||
m_Background.Copy(label.m_Background);
|
||||
m_TextPadding = label.m_TextPadding;
|
||||
m_TextStyle.Copy(label.m_TextStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
61
Runtime/Component/Child/TextPadding.cs
Normal file
61
Runtime/Component/Child/TextPadding.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to text.
|
||||
/// |文本的内边距设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TextPadding : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Top = 2;
|
||||
[SerializeField] private float m_Right = 4;
|
||||
[SerializeField] private float m_Left = 4;
|
||||
[SerializeField] private float m_Bottom = 2;
|
||||
|
||||
public TextPadding() { }
|
||||
|
||||
public TextPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
SetPadding(top, right, bottom, left);
|
||||
}
|
||||
|
||||
public void SetPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
m_Top = top; ;
|
||||
m_Right = right;
|
||||
m_Bottom = bottom;
|
||||
m_Left = left;
|
||||
}
|
||||
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float top
|
||||
{
|
||||
get { return m_Top; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float right
|
||||
{
|
||||
get { return m_Right; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float bottom
|
||||
{
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float left
|
||||
{
|
||||
get { return m_Left; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetComponentDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/TextPadding.cs.meta
Normal file
11
Runtime/Component/Child/TextPadding.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 407bba126a0854199a4686b44cc9407e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,16 +14,13 @@ namespace XCharts.Runtime
|
||||
[Serializable]
|
||||
public class TextStyle : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Font m_Font;
|
||||
[SerializeField] private bool m_AutoWrap = false;
|
||||
[SerializeField] private bool m_AutoAlign = true;
|
||||
[SerializeField] private float m_Rotate = 0;
|
||||
[SerializeField] private float m_ExtraWidth = 0;
|
||||
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||
[SerializeField] private bool m_AutoColor = false;
|
||||
[SerializeField] private Color m_Color = Color.clear;
|
||||
[SerializeField] private bool m_AutoBackgroundColor = false;
|
||||
[SerializeField] private Color m_BackgroundColor = Color.clear;
|
||||
[SerializeField] private int m_FontSize = 0;
|
||||
[SerializeField] private FontStyle m_FontStyle = FontStyle.Normal;
|
||||
[SerializeField] private float m_LineSpacing = 1f;
|
||||
@@ -33,6 +30,11 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private FontStyles m_TMPFontStyle = FontStyles.Normal;
|
||||
[SerializeField] private TextAlignmentOptions m_TMPAlignment = TextAlignmentOptions.Left;
|
||||
#endif
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Rotation of text.
|
||||
/// |文本的旋转。
|
||||
@@ -44,26 +46,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Extra width of text preferred width.
|
||||
/// |额外的宽度
|
||||
/// </summary>
|
||||
public float extraWidth
|
||||
{
|
||||
get { return m_ExtraWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ExtraWidth, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the offset of position.
|
||||
/// |坐标偏移。
|
||||
/// [Default: `Vector2.zero`]
|
||||
/// </summary>
|
||||
public Vector2 offset
|
||||
{
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetComponentDirty(); }
|
||||
}
|
||||
public Vector3 offsetv3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||
/// <summary>
|
||||
/// 是否开启自动颜色。当开启时,会自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor
|
||||
@@ -81,21 +63,6 @@ namespace XCharts.Runtime
|
||||
get { return m_Color; }
|
||||
set { if (PropertyUtil.SetColor(ref m_Color, value)) SetComponentDirty(); }
|
||||
}
|
||||
public bool autoBackgroundColor
|
||||
{
|
||||
get { return m_AutoBackgroundColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoBackgroundColor, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of text.
|
||||
/// |文本的背景颜色。
|
||||
/// [default: `Color.clear`]
|
||||
/// </summary>
|
||||
public Color backgroundColor
|
||||
{
|
||||
get { return m_BackgroundColor; }
|
||||
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the font of text. When `null`, the theme's font is used by default.
|
||||
/// |文本字体。
|
||||
@@ -172,11 +139,6 @@ namespace XCharts.Runtime
|
||||
get { return m_TMPFontStyle; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TMPFontStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
public TextAlignmentOptions tmpAlignment
|
||||
{
|
||||
get { return m_TMPAlignment; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TMPAlignment, value)) SetComponentDirty(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public TextStyle()
|
||||
@@ -213,11 +175,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
font = textStyle.font;
|
||||
rotate = textStyle.rotate;
|
||||
offset = textStyle.offset;
|
||||
autoColor = textStyle.autoColor;
|
||||
color = textStyle.color;
|
||||
autoBackgroundColor = textStyle.autoBackgroundColor;
|
||||
backgroundColor = textStyle.backgroundColor;
|
||||
fontSize = textStyle.fontSize;
|
||||
fontStyle = textStyle.fontStyle;
|
||||
lineSpacing = textStyle.lineSpacing;
|
||||
@@ -226,7 +184,6 @@ namespace XCharts.Runtime
|
||||
autoAlign = textStyle.autoAlign;
|
||||
#if dUI_TextMeshPro
|
||||
m_TMPFont = textStyle.tmpFont;
|
||||
m_TMPAlignment = textStyle.tmpAlignment;
|
||||
m_TMPFontStyle = textStyle.tmpFontStyle;
|
||||
#endif
|
||||
}
|
||||
@@ -256,17 +213,9 @@ namespace XCharts.Runtime
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
public TextAnchor GetAlignment(TextAnchor systemAlignment)
|
||||
public TextAnchor GetAlignment(TextAnchor defaultAlignment)
|
||||
{
|
||||
return m_AutoAlign ? systemAlignment : alignment;
|
||||
}
|
||||
|
||||
public Color32 GetBackgroundColor(Color32 chartBackgroundColor)
|
||||
{
|
||||
if (m_AutoColor || ChartHelper.IsClearColor(m_BackgroundColor))
|
||||
return chartBackgroundColor;
|
||||
else
|
||||
return m_BackgroundColor;
|
||||
return m_AutoAlign ? defaultAlignment : alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user