优化Background组件的生效条件,需要有单独的父节点

This commit is contained in:
monitor1394
2020-05-31 07:43:29 +08:00
parent 73919ab32a
commit 2de64580ec
12 changed files with 96 additions and 31 deletions

View File

@@ -101,6 +101,7 @@ namespace XCharts
/// 警告信息。
/// </summary>
public string warningInfo { get; protected set; }
public bool isControlledByLayout { get { return m_IsControlledByLayout; } }
/// <summary>
/// 强制开启鼠标事件检测。
/// </summary>
@@ -733,7 +734,7 @@ namespace XCharts
/// <returns></returns>
public bool CanShowBackgroundComponent()
{
return !m_IsControlledByLayout;
return !m_IsControlledByLayout && m_Background.runtimeActive;
}
/// <summary>
@@ -744,7 +745,9 @@ namespace XCharts
{
if (flag && !CanShowBackgroundComponent())
{
Debug.LogError("can't show background component:chart is controlled by LayoutGroup.");
var msg = "The background component cannot be activated because chart is controlled by LayoutGroup,"
+ " or its parent have more than one child.";
Debug.LogError(msg);
return;
}
m_Background.show = flag;