Exemplo n.º 1
0
 private void CheckDataZoom()
 {
     if (raycastTarget != m_DataZoom.show)
     {
         raycastTarget = m_DataZoom.show;
     }
     if (!m_DataZoom.show) return;
     if (m_DataZoom.showDetail)
     {
         Vector2 local;
         if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
             Input.mousePosition, null, out local))
         {
             m_DataZoom.SetLabelActive(false);
             return;
         }
         if (m_DataZoom.IsInSelectedZoom(local, coordinateX, coordinateWid)
             || m_DataZoom.IsInStartZoom(local, coordinateX, coordinateWid)
             || m_DataZoom.IsInEndZoom(local, coordinateX, coordinateWid))
         {
             m_DataZoom.SetLabelActive(true);
             RefreshDataZoomLabel();
         }
         else
         {
             m_DataZoom.SetLabelActive(false);
         }
     }
 }
Exemplo n.º 2
0
 private void CheckDataZoomLabel(DataZoom dataZoom)
 {
     if (dataZoom.enable && dataZoom.supportSlider && dataZoom.showDetail)
     {
         Vector2 local;
         if (!chart.ScreenPointToChartPoint(Input.mousePosition, out local))
         {
             dataZoom.SetLabelActive(false);
             return;
         }
         if (dataZoom.IsInSelectedZoom(local) ||
             dataZoom.IsInStartZoom(local) ||
             dataZoom.IsInEndZoom(local))
         {
             dataZoom.SetLabelActive(true);
             RefreshDataZoomLabel();
         }
         else
         {
             dataZoom.SetLabelActive(false);
         }
     }
     if (m_CheckDataZoomLabel)
     {
         m_CheckDataZoomLabel = false;
         var xAxis      = chart.GetXAxis(dataZoom.xAxisIndexs[0]);
         var startIndex = (int)((xAxis.data.Count - 1) * dataZoom.start / 100);
         var endIndex   = (int)((xAxis.data.Count - 1) * dataZoom.end / 100);
         if (m_DataZoomLastStartIndex != startIndex || m_DataZoomLastEndIndex != endIndex)
         {
             m_DataZoomLastStartIndex = startIndex;
             m_DataZoomLastEndIndex   = endIndex;
             if (xAxis.data.Count > 0)
             {
                 dataZoom.SetStartLabelText(xAxis.data[startIndex]);
                 dataZoom.SetEndLabelText(xAxis.data[endIndex]);
             }
             chart.InitAxisX();
         }
         var start = dataZoom.runtimeX + dataZoom.runtimeWidth * dataZoom.start / 100;
         var end   = dataZoom.runtimeX + dataZoom.runtimeWidth * dataZoom.end / 100;
         var hig   = dataZoom.runtimeHeight;
         dataZoom.UpdateStartLabelPosition(new Vector3(start - 10, chart.chartY + dataZoom.bottom + hig / 2));
         dataZoom.UpdateEndLabelPosition(new Vector3(end + 10, chart.chartY + dataZoom.bottom + hig / 2));
     }
 }