-
Notifications
You must be signed in to change notification settings - Fork 299
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
Scrolling element using middle mouse button #423
Scrolling element using middle mouse button #423
Conversation
Hey, welcome, and thanks for submitting the PR. I like the idea, and would be happy to accommodate this feature. It's possible to add Presumably, there is only one element that will be scrolled at a time, so I think it makes more sense to move the state variables to the Context, instead of keeping it locally in the Element. This also avoids the overhead of adding the state variables to every Element, even those that cannot or will not be scrolled. Then, you can dispatch |
Cool, good thoughts. I updated the PR to deal with logic suggested by you, but I still have some doubts:
|
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.
This looks better, nice. I have some more comments here.
The cursor, right. What the cursor looks like is really up to the client when implementing their system interface. But we should probably submit some built-in cursor names, and then users display their icon based on that. My suggestion: rmlui-scroll-idle
, rmlui-scroll-up
, rmlui-scroll-down
.
I see that most platforms don't really provide any good default cursor icons for this. As a placeholder, we could perhaps use the move
cursor in the built-in backends?
Finally, we should document in ProcessMouse...()
functions that button 2 now means middle mouse.
Suggestions already committed and now code it is simpler, thank you for review. |
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.
The code is looking much nicer now, good job.
I tested the behavior of this locally, and I think there are some quality-of-life improvements we can make. This is mostly about making it feel good, and there aren't necessarily any right or wrong answers, but here are some suggestions:
- Maybe cancel the scroll state if there is nothing to scroll. You can test this by checking if the event is still propagating.
- It would be nice to support middle-mouse-hold-and-scroll, then release. I use this mode quite a lot myself.
- The minimum scroll speed is 1px/frame. This can actually be quite fast, depending on DPI and FPS. We could accumulate subpixel movement, and submit them once they are greater than one.
- It feels very sensitive near the reference, while opposite far away from the reference. Maybe it would feel better with a nonlinear speed vs distance? Try to square it? And perhaps add a deadzone near zero. This is mostly about tuning and feeling, we can tune this more later on as well.
Hmm I don't have many experience with these two remaining items that you mentioned. I ll take a look and try something. |
Nice, this is ready for merging in my view. We can keep tweaking it later on as well, with the mentioned requests. Let me know if you are happy with it like this, or when you are finished with any further changes. |
I agree, we can merge it. I will quote these items that you mentioned on the issue that I opened, then we can close the issue when we finally deal with them. |
Sounds good, thanks for the nice PR! :) |
Related to: #422