-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add scroll widgets #157
Add scroll widgets #157
Conversation
The widget will render its children in a container that can be scrolled both horizontally and vertically. The widget itself does not render any scroll bars or other indicators of current scroll position. Since this view is heavily based on the ListView widget it inherits the same `cursor` functionality to show the current position of a selected widget. Known Issues ============ 1. The view currently does not enforce a maximum width on the content to be able to correctly figure out whether the content can still be scrolled horizontally. This will cause the widget to draw beyond its boundaries horizontally. 2. When the last widget rendered is taller than a single row the whole widget will be drawn. This will cause the widget to draw beyond its boundaries vertically.
This widget is intended to wrap a ScrollView widget and show vertical and horizontal scroll bars as indicators of scroll position in the ScrollView. It's recommended to provide the estimated content sizes with as much accuracy as possible for the best user experience and performance. If estimated content sizes are not provided the scroll bar sizes and positions will be estimated using the size of child arrays. This is not perfect and will cause inconsistencies if the child widgets aren't all the exact same heights.
This adds an example demonstrating the use of the ScrollView and ScrollBars widgets. It also includes keybindings to change how the child widgets are laid out so you can see how that affects how the scroll bars are rendered. The content size estimates are deliberately wrong to demonstrate how that affects the scroll bars. The value is intended to be modified by whoever is testing the example.
Is this only true when word wrap is off? |
Hmm, sort of? In the example the word wrap is triggered by giving the It's not the scroll view itself that's enforcing the word wrap 🤔 I guess we could set a max width constraint on children in the scroll view on request when something like a What do you think? |
What do you think?
I think we leave it up to the user of the library to handle it, as you have
shown in the example.
Great work! The examples work extremely well. Despite the known issues, I'll
merge this as is - it's a huge amount of work and we'll get those small bugs
fixed as they crop up for real use cases.
Thanks!
|
Thank you ❤️
Yeah, that's exactly what I was thinking 🚀 |
Description
ScrollView
widget tovxfw
.ScrollBars
widget tovxfw
.scroll
example to demonstrate usage.Known Issues
Testing instructions
scroll
example withzig build -Dexample=scroll example
and check that it behaves as expected.Model
and see how the views will draw beyond the constraints.Keybindings in example