/// <summary> /// Calculates the max count of visible items. /// </summary> protected override void CalculateMaxVisibleItems() { var spacing = LayoutBridge.GetSpacing(); if (IsHorizontal()) { var height = scrollHeight + spacing - LayoutBridge.GetFullMargin(); itemsPerRow = Mathf.CeilToInt(scrollWidth / itemWidth) + 1; itemsPerRow = Mathf.Max(2, itemsPerRow); itemsPerColumn = Mathf.FloorToInt(height / (itemHeight + spacing)); itemsPerColumn = Mathf.Max(1, itemsPerColumn); } else { var width = scrollWidth + spacing - LayoutBridge.GetFullMargin(); itemsPerRow = Mathf.FloorToInt(width / (itemWidth + spacing)); itemsPerRow = Mathf.Max(1, itemsPerRow); itemsPerColumn = Mathf.CeilToInt(scrollHeight / itemHeight) + 1; itemsPerColumn = Mathf.Max(2, itemsPerColumn); } maxVisibleItems = itemsPerRow * itemsPerColumn; }
/// <summary> /// Gets the item position bottom. /// </summary> /// <returns>The item position bottom.</returns> /// <param name="index">Index.</param> public override float GetItemPositionBottom(int index) { return(GetItemPosition(index) + GetItemHeight(DataSource[index]) + LayoutBridge.GetFullMargin() - GetScrollSize()); }