mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 02:40:13 +00:00
增加Theme的Unbind按钮用于解绑复制图表时的主题 #118
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
## Latest
|
## Latest
|
||||||
|
|
||||||
|
* (2021.03.22) Added `Theme` `Unbind` button to unbind theme when copying chart #118
|
||||||
* (2021.03.18) Fixed an issue where the check box after `Foldout` in `Inspector` could not be checked
|
* (2021.03.18) Fixed an issue where the check box after `Foldout` in `Inspector` could not be checked
|
||||||
* (2021.03.18) Fixed an issue with `BarChart` displaying an exception in the `0` value
|
* (2021.03.18) Fixed an issue with `BarChart` displaying an exception in the `0` value
|
||||||
* (2021.03.14) Fixed `Tooltip` indicator was not indicating the correct location in some cases
|
* (2021.03.14) Fixed `Tooltip` indicator was not indicating the correct location in some cases
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
## Latest
|
## Latest
|
||||||
|
|
||||||
|
* (2021.03.22) 增加`Theme`的`Unbind`按钮用于解绑复制图表时的主题 #118
|
||||||
* (2021.03.18) 修复`Inspector`下`Foldout`后的勾选框无法选中的问题
|
* (2021.03.18) 修复`Inspector`下`Foldout`后的勾选框无法选中的问题
|
||||||
* (2021.03.18) 修复`BarChart`在`0`数值时显示异常的问题
|
* (2021.03.18) 修复`BarChart`在`0`数值时显示异常的问题
|
||||||
* (2021.03.14) 修复`Tooltip`的指示器在某些情况下指示位置不准的问题
|
* (2021.03.14) 修复`Tooltip`的指示器在某些情况下指示位置不准的问题
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ namespace XCharts
|
|||||||
base.OnGUI(pos, prop, label);
|
base.OnGUI(pos, prop, label);
|
||||||
var defaultWidth = pos.width;
|
var defaultWidth = pos.width;
|
||||||
var defaultX = pos.x;
|
var defaultX = pos.x;
|
||||||
var btnWidth = 45;
|
var btnWidth = 50;
|
||||||
ChartEditorHelper.MakeFoldout(ref m_DrawRect, ref m_ThemeModuleToggle, "Theme");
|
ChartEditorHelper.MakeFoldout(ref m_DrawRect, ref m_ThemeModuleToggle, "Theme");
|
||||||
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
if (m_ThemeModuleToggle)
|
if (m_ThemeModuleToggle)
|
||||||
{
|
{
|
||||||
m_DrawRect.x = defaultX + defaultWidth - 2 * btnWidth - 2;
|
m_DrawRect.x = defaultX + defaultWidth - 3 * btnWidth - 2;
|
||||||
m_DrawRect.width = btnWidth;
|
m_DrawRect.width = btnWidth;
|
||||||
var chart = prop.serializedObject.targetObject as BaseChart;
|
var chart = prop.serializedObject.targetObject as BaseChart;
|
||||||
var lastFont = chart.theme.font;
|
var lastFont = chart.theme.font;
|
||||||
@@ -46,6 +46,12 @@ namespace XCharts
|
|||||||
chart.theme.ResetTheme();
|
chart.theme.ResetTheme();
|
||||||
chart.RefreshAllComponent();
|
chart.RefreshAllComponent();
|
||||||
}
|
}
|
||||||
|
m_DrawRect.x = defaultX + defaultWidth - 2 * btnWidth - 2;
|
||||||
|
m_DrawRect.width = btnWidth;
|
||||||
|
if (GUI.Button(m_DrawRect, new GUIContent("Unbind", "Unbind the Theme from another chart")))
|
||||||
|
{
|
||||||
|
chart.UnbindTheme();
|
||||||
|
}
|
||||||
m_DrawRect.x = defaultX + defaultWidth - btnWidth;
|
m_DrawRect.x = defaultX + defaultWidth - btnWidth;
|
||||||
m_DrawRect.width = btnWidth;
|
m_DrawRect.width = btnWidth;
|
||||||
if (GUI.Button(m_DrawRect, new GUIContent("Export", "Export theme to asset for a new theme")))
|
if (GUI.Button(m_DrawRect, new GUIContent("Export", "Export theme to asset for a new theme")))
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
public virtual SerieData AddData(int serieIndex, float open, float close, float lowest, float heighest, string dataName = null)
|
public virtual SerieData AddData(int serieIndex, float open, float close, float lowest, float heighest, string dataName = null)
|
||||||
{
|
{
|
||||||
var serieData = m_Series.AddData(serieIndex, open, close, lowest,heighest, dataName);
|
var serieData = m_Series.AddData(serieIndex, open, close, lowest, heighest, dataName);
|
||||||
if (serieData != null)
|
if (serieData != null)
|
||||||
{
|
{
|
||||||
var serie = m_Series.GetSerie(serieIndex);
|
var serie = m_Series.GetSerie(serieIndex);
|
||||||
@@ -708,5 +708,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
return SeriesHelper.ContainsSerie(m_Series, serieType);
|
return SeriesHelper.ContainsSerie(m_Series, serieType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnbindTheme()
|
||||||
|
{
|
||||||
|
var theme = m_Theme.CloneTheme();
|
||||||
|
m_Theme = theme;
|
||||||
|
RefreshChart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,6 +304,17 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 克隆主题。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ChartTheme CloneTheme()
|
||||||
|
{
|
||||||
|
var theme = ScriptableObject.CreateInstance<ChartTheme>();
|
||||||
|
InitChartComponentTheme(theme);
|
||||||
|
theme.CopyTheme(this);
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user