Repository navigation
ENH: Add opt-in scroll support to Slider - #32619
soconnor0919 wants to merge 4 commits into
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on discourse chat for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
PR summary
Closes #30602.
Add
Slider(..., scroll=True)so users can make small adjustments by scrolling over a horizontal or vertical slider. Plot authors can enable it where scrolling is useful.Each nonzero scroll event moves the slider one increment in the scroll direction. A numeric
valstepsets the increment. With a sequence, the slider moves to the next allowed value in that direction. With novalstep, it moves by 1% of its range. Scroll updates use the same bounds checks and callbacks as dragging.The patch also makes toolbar scroll zoom respect the axes’ navigation setting. The regression test checks that scrolling with
xheld moves the slider without zooming its axes, while the same gesture still zooms the x-axis of a regular plot.We found this issue while looking for a project for a graduate class and wanted to share what we built upstream (the review or merge outcome has no bearing on our course credit).
Testing
The widget and backend tests reported 249 passed, 1 skipped on the changes at
f91ecfd5b3. We tried the original demo with a trackpad and confirmed that the updated gallery example works with a physical mouse wheel on the native macOS backend. A focused Sphinx build rendered the gallery example, API documentation, and release note. A simulated scroll also confirmed that the gallery slider updates the plotted line.AI Disclosure
OpenAI GPT-6.2 Sol was used to explore the issue, suggest the changes to make, & determine where the changes should be made.
PR quality check