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

Fix asymmetric behavior of scroll direction #443

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

MiSawa
Copy link
Contributor

@MiSawa MiSawa commented Dec 9, 2023

When the scroll div is sufficiently large, you'll see a weird asymmetric behavior of scrolling; when you scroll towards the positive direction, the actual scroll happens after some ball movement, but when you scroll towards the negative direction, the scroll happens with a little ball movement.
This happens because the behavior of right shift >> div is not symmetric for positive and negative lhs. For example, 1 >> 3 is zero, but -1 >> 3 is -1. https://wandbox.org/permlink/M943OJ3soMrS4uH6

This PR fixes the issue by using division / (1 << div) instead, which truncates result towards zero.

@Yowkees Yowkees requested a review from koron December 11, 2023 02:49
@koron
Copy link
Collaborator

koron commented Mar 21, 2024

Thank you for your good point!

The only thing I'm worried about is the size increase due to division.
I'll do some experimentation and then merge.

@koron
Copy link
Collaborator

koron commented Mar 21, 2024

I confirmed this increases 62 bytes.

Are there any good tricks to reduce this?

@koron
Copy link
Collaborator

koron commented Mar 21, 2024

I fix this to reduce size in #507

@koron koron merged commit d4ff08c into Yowkees:main Mar 21, 2024
20 checks passed
@koron
Copy link
Collaborator

koron commented Mar 21, 2024

I merged this with #507.

Thank you

@MiSawa
Copy link
Contributor Author

MiSawa commented Mar 21, 2024

Thank YOU!

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