getShiftedState

open fun getShiftedState(scrollOffset: Float, minScrollOffset: Float, maxScrollOffset: Float): KeylineState

Gets a shifted KeylineState appropriate for a scroll offset.

The first and last items in a carousel should never detach or scroll away from the edges of the carousel container. To enforce this while still allowing each item in the carousel to enter the focused range when the focused range is not, by default, at the beginning or end of the list, keylines need to shift along the scrolling axis in order to reach every item.

Return

a KeylineState that has been shifted according on the scroll offset.

Parameters

scrollOffset

the scroll offset

minScrollOffset

the minimum scroll offset. This moves the items as far right in a container as possible.

maxScrollOffset

the maximum scroll offset. This moves the items as far left in a container as possible.