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

Improve RichTextBox scrolling logic #34

Merged
merged 1 commit into from
Jul 11, 2019
Merged

Improve RichTextBox scrolling logic #34

merged 1 commit into from
Jul 11, 2019

Conversation

Xanfre
Copy link
Contributor

@Xanfre Xanfre commented Jul 11, 2019

Currently, the control only checks if the mouse wheel distance is greater or less than zero while ignoring the distance itself, which can result in the scroll procedure being sent far too frequently under some circumstances. Here, we can store the mouse wheel accumulation and increment or decrement it when the scroll procedure is sent to prevent this from happening.

@FenPhoenix
Copy link
Owner

Works fine, although I'm unable to notice a difference myself. Do you mean that it was sometimes scrolling multiple times when it should have only scrolled once? Out of curiosity, how did you make it happen?

@Xanfre
Copy link
Contributor Author

Xanfre commented Jul 11, 2019

It only happens, from what I can tell, on high-resolution mouse wheels. No issue occurs at all on a notched wheel since the distance is reported at each notch; however, moving a modern laptop's trackpad will scroll a disproportionate distance in the control because the distance is reported more frequently.

This modified procedure will only scroll the control at distance intervals of 120, which is one notch in a standard mouse wheel.

@FenPhoenix
Copy link
Owner

Okay, cool. Merging. Thanks for the continued improvements.

@FenPhoenix FenPhoenix merged commit da811d8 into FenPhoenix:master Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants