-
-
Notifications
You must be signed in to change notification settings - Fork 492
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 area element #1072
Add scroll area element #1072
Conversation
@eli-kha Thanks for this PR! |
@falkoschindler I wasn't sure if it was better to seek guidance in a PR or the discussion. The code is currently broken and I couldn't get the scroll event to trigger a callback in my testing code. Some guidance on how to get it to work or what to test would be much appreciated |
I resolved the event issues and feel ready for a proper review |
# Conflicts: # website/documentation.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eli-kha Thanks again for this pull request!
I updated the code here and there (see 2d62887) and merged it. 🙂
- Now the
ScrollEventArguments
follow the Python naming convention instead of the original Quasar attribute names. This makes the scroll area implementation a bit longer, but feels more natural for the user. - The
_handle_scroll
method should usehandle_event
from the "events" module. This allows using async handlers and automatically uses the right UI context, e.g. when adding new UI elements. - I renamed the
set_scroll_position
to the simplerscroll_to
. Furthermore I introduced separate parameterspixels
andpercent
to distinguish both units. Using the type alone seems a bit unreliable. - The default size of 200x200px seems a bit arbitrary. But I understand that giving no initial size causes the scroll area to collapse to zero size, which might confuse the user. So I decided to use the same somewhat arbitrary values of 100% width and 16rem height like for
ui.aggrid
.
Scroll Area is a Quasar component that offers a neat way of customizing the scrollbars by encapsulating your content.
It is particularly useful when you want to allow large content in a smaller element.
Some added benefits are better controls over the scroll interface and programmatic access to the scroll movement.
This PR introduces a new element with matching CSS definitions based on the feedback I got here.
In addition, I want to expose the scroll event and the
setScrollPosition
andsetScrollPercentage
EDIT:
The event and functions are not working ATM.