From 5d85fdb7f96c5e2aecb0a4841328bf07bb841ad3 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Fri, 22 May 2020 08:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=83=8C=E6=99=AF=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E8=83=BD=E6=98=BE=E7=A4=BA=E5=9C=A8=E6=9C=80?= =?UTF-8?q?=E5=89=8D=E9=9D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/Runtime/Internal/BaseChart.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Assets/XCharts/Runtime/Internal/BaseChart.cs b/Assets/XCharts/Runtime/Internal/BaseChart.cs index 57e9f8ea..b965410d 100644 --- a/Assets/XCharts/Runtime/Internal/BaseChart.cs +++ b/Assets/XCharts/Runtime/Internal/BaseChart.cs @@ -267,12 +267,19 @@ namespace XCharts var backgroundImage = ChartHelper.GetOrAddComponent(m_BackgroundRoot); var backgroundRect = m_BackgroundRoot.GetComponent(); backgroundRect.position = rectTransform.position; - backgroundRect.SetSiblingIndex(rectTransform.GetSiblingIndex() - 1); - backgroundImage.sprite = m_Background.image; backgroundImage.type = m_Background.imageType; backgroundImage.color = m_Background.imageColor; m_BackgroundRoot.SetActive(m_Background.show); + var siblindIndex = rectTransform.GetSiblingIndex(); + if (siblindIndex == 0) + { + backgroundRect.SetSiblingIndex(0); + } + else + { + backgroundRect.SetSiblingIndex(rectTransform.GetSiblingIndex() - 1); + } } private void InitTitle()