/// <summary> /// Scrolls to item with specifid index. /// </summary> /// <param name="index">Index.</param> public override void ScrollTo(int index) { if (!CanOptimize()) { return; } var top = GetScrollValue(); var bottom = GetScrollValue() + scrollHeight; var item_starts = ItemStartAt(index); var item_ends = ItemEndAt(index) + LayoutBridge.GetMargin(); if (item_starts < top) { SetScrollValue(item_starts); } else if (item_ends > bottom) { SetScrollValue(item_ends - GetScrollSize()); } }
/// <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) + DataSource[index].Height - LayoutBridge.GetSpacing() + LayoutBridge.GetMargin() - GetScrollSize()); }
/// <summary> /// Gets the item position bottom. /// </summary> /// <returns>The item position bottom.</returns> /// <param name="index">Index.</param> public override float GetItemPositionBottom(int index) { var block = Mathf.Min(GetBlockIndex(index) + 1, BlockSizes.Count); return(BlockSizes.GetRange(0, block).SumFloat() + (LayoutBridge.GetSpacing() * (block - 1)) + LayoutBridge.GetMargin() - GetScrollSize()); }