Skip to content
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

slider: handle mouse wheel events #2565

Merged
merged 3 commits into from
Sep 13, 2024
Merged

Conversation

kiedtl
Copy link
Contributor

@kiedtl kiedtl commented Sep 2, 2024

Make slider + vertical_slider handle mouse wheel events -- i.e. when hovered, scrolling the mouse wheel will modify the slider.


Question: currently the slider is incr/decremented by self.step for both ScrollDelta::Pixels and ScrollDelta::Lines. This seems appropriate for Lines, but I'm not sure about Pixels. (It felt fine to me when testing, but I'm not sure what the "expected" behaviour is.)

@hecrj hecrj added this to the 0.13 milestone Sep 13, 2024
@hecrj hecrj added feature New feature or request widget addition labels Sep 13, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I made a change to only enable slider scrolling when the Ctrl modifier is pressed. This way, we avoid accidental slider changes when inside a scrollable.

@hecrj hecrj enabled auto-merge September 13, 2024 21:48
@hecrj hecrj merged commit f3b51e4 into iced-rs:master Sep 13, 2024
12 checks passed
@kiedtl
Copy link
Contributor Author

kiedtl commented Sep 13, 2024

Oh. I was trying to emulate Windows-specific behavior here, specifically the app I was replacing with my Iced project. Of course, users can adjust, but the initial friction will be there.

So I suppose there's no way for a widget inside another to prevent the outer widget from capturing its events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants