distanceToNext
open override fun distanceToNext(carousel: Carousel<T, *>, position: CarouselBehavior.Presenter.Position, offset: Vector2D, items: (CarouselBehavior.Presenter.Position) -> Carousel.PresentedItem?): CarouselBehavior.Presenter.Distance(source)
A Carousel will call this method when trying to do manual movement. This is a fundamentally different problem than it needs to solve when skipping through items (interpolate between indexes). This requires mapping pixel offsets to indexes. Only a Carousel's Presenter knows how items are laid out and can provide any information about "distance" between them. Hence, this API.
The magnitude of the result should be in pixel scale, since it will be used to decide the relative index for values passed to Carousel.moveManually.
Parameters
carousel
being updated
position
indicating the item currently in the "selected" position
offset
from the item at position
items
lambda for creating/recycling PresentedItem