mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 03:58:49 +00:00
增加SymbolStyle的borderWidth和emptyColor配置
This commit is contained in:
@@ -78,6 +78,7 @@ slug: /changelog
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2024.12.23) 增加`SymbolStyle`的`borderWidth`和`emptyColor`配置
|
||||||
* (2024.12.17) 增加`UISlider`扩展组件
|
* (2024.12.17) 增加`UISlider`扩展组件
|
||||||
* (2024.12.10) 增加`UIToggle`扩展组件
|
* (2024.12.10) 增加`UIToggle`扩展组件
|
||||||
* (2024.12.09) 修复`UITable`的`scrollbar`无法拖动的问题
|
* (2024.12.09) 修复`UITable`的`scrollbar`无法拖动的问题
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace XCharts.Editor
|
|||||||
PropertyField(prop, "m_Color");
|
PropertyField(prop, "m_Color");
|
||||||
PropertyField(prop, "m_Size");
|
PropertyField(prop, "m_Size");
|
||||||
PropertyField(prop, "m_Gap");
|
PropertyField(prop, "m_Gap");
|
||||||
|
PropertyField(prop, "m_BorderWidth");
|
||||||
|
PropertyField(prop, "m_EmptyColor");
|
||||||
PropertyField(prop, "m_Offset");
|
PropertyField(prop, "m_Offset");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ namespace XCharts.Editor
|
|||||||
{
|
{
|
||||||
EditorGUI.LabelField(drawRect, name);
|
EditorGUI.LabelField(drawRect, name);
|
||||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
||||||
var diff = 13 + EditorGUI.indentLevel * 14;
|
var diff = 12 + EditorGUI.indentLevel * 14;
|
||||||
var offset = diff - INDENT_WIDTH;
|
var offset = diff - INDENT_WIDTH;
|
||||||
var tempWidth = (rectWidth - startX + diff) / 2;
|
var tempWidth = (rectWidth - startX + diff) / 2;
|
||||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
|
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
|
||||||
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
var centerYRect = new Rect(centerXRect.x + tempWidth - offset + 3.4f, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||||
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
||||||
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
@@ -326,7 +326,13 @@ namespace XCharts.Editor
|
|||||||
var foldoutRect = drawRect;
|
var foldoutRect = drawRect;
|
||||||
foldoutRect.xMax -= 10;
|
foldoutRect.xMax -= 10;
|
||||||
bool flag = EditorGUI.Foldout(foldoutRect, foldout, listProp.displayName, true);
|
bool flag = EditorGUI.Foldout(foldoutRect, foldout, listProp.displayName, true);
|
||||||
ChartEditorHelper.DrawMenu(drawRect, menus);
|
if (!flag)
|
||||||
|
{
|
||||||
|
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
||||||
|
var sizeRect = new Rect(startX, drawRect.y + 1f, (EditorGUI.indentLevel + 1) * 15, drawRect.height - 1);
|
||||||
|
EditorGUI.IntField(sizeRect, GUIContent.none, listProp.arraySize);
|
||||||
|
DrawMenu(drawRect, menus);
|
||||||
|
}
|
||||||
height += headerHeight;
|
height += headerHeight;
|
||||||
drawRect.y += headerHeight;
|
drawRect.y += headerHeight;
|
||||||
drawRect.width = rawWidth;
|
drawRect.width = rawWidth;
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ namespace XCharts.Runtime
|
|||||||
[SerializeField] protected Sprite m_Image;
|
[SerializeField] protected Sprite m_Image;
|
||||||
[SerializeField] protected Image.Type m_ImageType;
|
[SerializeField] protected Image.Type m_ImageType;
|
||||||
[SerializeField] protected Color32 m_Color;
|
[SerializeField] protected Color32 m_Color;
|
||||||
|
[SerializeField][Since("v3.13.0")] protected float m_BorderWidth = 0f;
|
||||||
|
[SerializeField][Since("v3.13.0")] protected Color32 m_EmptyColor;
|
||||||
|
|
||||||
public virtual void Reset()
|
public virtual void Reset()
|
||||||
{
|
{
|
||||||
@@ -183,6 +185,24 @@ namespace XCharts.Runtime
|
|||||||
get { return m_Color; }
|
get { return m_Color; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_Color, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Color, value)) SetAllDirty(); }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// the border width of symbol.
|
||||||
|
/// ||图形的边框宽度。
|
||||||
|
/// </summary>
|
||||||
|
public float borderWidth
|
||||||
|
{
|
||||||
|
get { return m_BorderWidth; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// the color of empty symbol.
|
||||||
|
/// ||空心图形的颜色。
|
||||||
|
/// </summary>
|
||||||
|
public Color32 emptyColor
|
||||||
|
{
|
||||||
|
get { return m_EmptyColor; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_EmptyColor, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
public Vector3 offset3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
public Vector3 offset3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||||
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
|
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tickness > 0)
|
if (tickness > 0 && !ChartHelper.IsClearColor(borderColor))
|
||||||
UGL.DrawDoughnut(vh, pos, symbolSize, symbolSize + tickness, borderColor, borderColor, color, smoothness);
|
UGL.DrawDoughnut(vh, pos, symbolSize, symbolSize + tickness, borderColor, borderColor, color, smoothness);
|
||||||
else
|
else
|
||||||
UGL.DrawCricle(vh, pos, symbolSize, color, toColor, smoothness);
|
UGL.DrawCricle(vh, pos, symbolSize, color, toColor, smoothness);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SymbolType.EmptyCircle:
|
case SymbolType.EmptyCircle:
|
||||||
|
if (tickness == 0) tickness = 4f;
|
||||||
if (gap > 0)
|
if (gap > 0)
|
||||||
{
|
{
|
||||||
UGL.DrawCricle(vh, pos, symbolSize + gap, backgroundColor, smoothness);
|
UGL.DrawCricle(vh, pos, symbolSize + gap, backgroundColor, smoothness);
|
||||||
@@ -57,6 +58,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SymbolType.EmptyRect:
|
case SymbolType.EmptyRect:
|
||||||
|
if (tickness == 0) tickness = 4f;
|
||||||
if (gap > 0)
|
if (gap > 0)
|
||||||
{
|
{
|
||||||
UGL.DrawSquare(vh, pos, symbolSize + gap, backgroundColor);
|
UGL.DrawSquare(vh, pos, symbolSize + gap, backgroundColor);
|
||||||
@@ -75,6 +77,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
if (type == SymbolType.EmptyTriangle)
|
if (type == SymbolType.EmptyTriangle)
|
||||||
{
|
{
|
||||||
|
if (tickness == 0) tickness = 4f;
|
||||||
UGL.DrawEmptyTriangle(vh, pos, symbolSize * 1.4f, tickness * 2f, color, emptyColor);
|
UGL.DrawEmptyTriangle(vh, pos, symbolSize * 1.4f, tickness * 2f, color, emptyColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -92,6 +95,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
if (type == SymbolType.EmptyDiamond)
|
if (type == SymbolType.EmptyDiamond)
|
||||||
{
|
{
|
||||||
|
if (tickness == 0) tickness = 4f;
|
||||||
UGL.DrawEmptyDiamond(vh, pos, xRadius, yRadius, tickness, color, emptyColor);
|
UGL.DrawEmptyDiamond(vh, pos, xRadius, yRadius, tickness, color, emptyColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -124,6 +128,7 @@ namespace XCharts.Runtime
|
|||||||
arrowOffset, arrowDent, color);
|
arrowOffset, arrowDent, color);
|
||||||
if (type == SymbolType.EmptyArrow)
|
if (type == SymbolType.EmptyArrow)
|
||||||
{
|
{
|
||||||
|
if (tickness == 0) tickness = 4f;
|
||||||
arrowWidth = (symbolSize - tickness) * 2;
|
arrowWidth = (symbolSize - tickness) * 2;
|
||||||
arrowHeight = arrowWidth * 1.5f;
|
arrowHeight = arrowWidth * 1.5f;
|
||||||
arrowOffset = 0;
|
arrowOffset = 0;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
private static Dictionary<string, Color32> s_ColorCached = new Dictionary<string, Color32>();
|
private static Dictionary<string, Color32> s_ColorCached = new Dictionary<string, Color32>();
|
||||||
public static readonly Color32 clearColor32 = new Color32(0, 0, 0, 0);
|
public static readonly Color32 clearColor32 = new Color32(0, 0, 0, 0);
|
||||||
|
public static readonly Color32 white = new Color32(255, 255, 255, 255);
|
||||||
public static readonly Vector2 zeroVector2 = Vector2.zero;
|
public static readonly Vector2 zeroVector2 = Vector2.zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user