Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
layout: add API for efficiently scrolling to and by items
The majority of scrolling happens by manipulating the index of the first displayed item instead of by just manipulating the offset. This lets us avoid having to render all items that were scrolled past. Instead of numbers of items we could've accepted a ratio in [0, 1] to scroll by or to, to match the data we get from scrollbars. However, there are more use cases for scrolling by items, such as keyboard shortcuts, go-to dialogs, etc. And converting from [0, 1] to items is trivial for the user as long as they know the number of items, and will usually be handled for them by a theme. Signed-off-by: Dominik Honnef <[email protected]>
- Loading branch information