Exemplo n.º 1
0
 public bool IsListItemVisible(int index, float err = 1f)
 {
     if (IsInited)
     {
         RectTransform rt_v = ScrollRect.viewport;
         LayoutItem    item = GetListItem(index);
         if (item != null)
         {
             Rect rect_child = UGUITools.GetRelativeRect(rt_v, item.CacheRectTransform);
             Rect rect_v     = rt_v.rect;
             if (IsVertical)
             {
                 bool is_inside = rect_child.yMin + err >= rect_v.yMin && rect_child.yMax - err <= rect_v.yMax;
                 return(is_inside);
             }
             else
             {
                 bool is_inside = rect_child.xMin + err >= rect_v.xMin && rect_child.xMax - err <= rect_v.xMax;
                 return(is_inside);
             }
         }
     }
     return(false);
 }