mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
[optimize] visualmap
This commit is contained in:
@@ -76,6 +76,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private bool m_ShowUI = false;
|
||||
[SerializeField] private Type m_Type = Type.Continuous;
|
||||
[SerializeField] private SelectedMode m_SelectedMode = SelectedMode.Multiple;
|
||||
[SerializeField] private int m_SerieIndex = 0;
|
||||
@@ -104,11 +105,8 @@ namespace XCharts.Runtime
|
||||
public VisualMapContext context = new VisualMapContext();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to display components. If set to false, it will not show up, but the data mapping function still exists.
|
||||
/// |
|
||||
/// 是否显示组件。如果设置为 false,不会显示,但是数据映射的功能还存在。
|
||||
///
|
||||
/// [default: true]
|
||||
/// Whether to enable components.
|
||||
/// |组件是否生效。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -116,6 +114,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display components. If set to false, it will not show up, but the data mapping function still exists.
|
||||
/// |是否显示组件。如果设置为 false,不会显示,但是数据映射的功能还存在。
|
||||
/// </summary>
|
||||
public bool showUI
|
||||
{
|
||||
get { return m_ShowUI; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowUI, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the type of visualmap component.
|
||||
/// |组件类型。
|
||||
/// </summary>
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace XCharts.Runtime
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
var visualMap = component;
|
||||
if (!visualMap.show) return;
|
||||
if (!visualMap.show || !visualMap.showUI) return;
|
||||
switch (visualMap.type)
|
||||
{
|
||||
case VisualMap.Type.Continuous:
|
||||
@@ -319,7 +319,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void OnDragVisualMapStart(VisualMap visualMap)
|
||||
{
|
||||
if (!visualMap.show || !visualMap.calculable)
|
||||
if (!visualMap.show || !visualMap.showUI || !visualMap.calculable)
|
||||
return;
|
||||
|
||||
var inMinRect = visualMap.IsInRangeMinRect(chart.pointerPos, chart.chartRect, chart.theme.visualMap.triangeLen);
|
||||
@@ -340,7 +340,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void OnDragVisualMap(VisualMap visualMap)
|
||||
{
|
||||
if (!visualMap.show || !visualMap.calculable)
|
||||
if (!visualMap.show || !visualMap.showUI || !visualMap.calculable)
|
||||
return;
|
||||
|
||||
if (!visualMap.context.minDrag && !visualMap.context.maxDrag)
|
||||
@@ -360,7 +360,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void OnDragVisualMapEnd(VisualMap visualMap)
|
||||
{
|
||||
if (!visualMap.show || !visualMap.calculable)
|
||||
if (!visualMap.show || !visualMap.showUI || !visualMap.calculable)
|
||||
return;
|
||||
|
||||
if (visualMap.context.minDrag || visualMap.context.maxDrag)
|
||||
|
||||
@@ -147,6 +147,8 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (visualMap == null)
|
||||
return false;
|
||||
if (!visualMap.show)
|
||||
return false;
|
||||
|
||||
if (visualMap.inRange.Count <= 0 && visualMap.pieces.Count <= 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user