Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

fix sensitive scale on touchpad#244

Merged
Enter-tainer merged 3 commits intomainfrom
mgt/sensitive-scale
Feb 17, 2024
Merged

fix sensitive scale on touchpad#244
Enter-tainer merged 3 commits intomainfrom
mgt/sensitive-scale

Conversation

@Enter-tainer
Copy link
Owner

@Enter-tainer Enter-tainer commented Feb 10, 2024

fix #238 fix #208

I just randomly choose a threshold, and currently I don't have a mouse. Please test!

@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Feb 10, 2024

Please check https://github.com/mozilla/pdf.js/blob/7cfcd00a385314a05e0ff247d80262200a0e1556/web/app.js#L2616-L2618. The magic numbers are really magic and they affect user experience. We may not seek a homemade "pinch-to-zoom" but just follow what pdf.js does.

@Enter-tainer
Copy link
Owner Author

these code looks far more complicate than current ones. it includes checks for different hardware(touchpad, ctrl+wheel) and different delta mode(line, pixel, page). do you mean we should do similar thing? i think it is too complex for now

@Myriad-Dreamin
Copy link
Collaborator

these code looks far more complicate than current ones. it includes checks for different hardware(touchpad, ctrl+wheel) and different delta mode(line, pixel, page). do you mean we should do similar thing? i think it is too complex for now

The current ctrl+wheel handling was simplified from that in pdf.js. Following what it does, we didn't accumulate deltaDistance in line mode (when using mouse). However, this PR would like to accumulate deltaDistance for any devices (when using mouse, touchpad etc.).

Though pdf.js implements a complicated wheel handler, I think we need to understand that handler before making any changes.

@Enter-tainer
Copy link
Owner Author

does mouse use line mode? i dont have a mouse at this moment

@Enter-tainer
Copy link
Owner Author

for now i think we can simply divide the problem into 2 parts. for pixel ones, we accumulate scroll distance and only trigger 1 scale event. for line ones, we can reuse the original logic

@Myriad-Dreamin
Copy link
Collaborator

does mouse use line mode? i dont have a mouse at this moment

I don't have one either. 😿 😸

@Myriad-Dreamin
Copy link
Collaborator

for now i think we can simply divide the problem into 2 parts. for pixel ones, we accumulate scroll distance and only trigger 1 scale event. for line ones, we can reuse the original logic

there are two parts in the wheel handler of pdf.js. the first one is for smooth zooming with a touchpad like device, and we are on the second part. We may just replicate the second part for simplicity.

@Enter-tainer Enter-tainer force-pushed the mgt/sensitive-scale branch 2 times, most recently from 995e5f3 to b8af7dc Compare February 12, 2024 07:04
@Enter-tainer
Copy link
Owner Author

I just test this with my mouse and it works the same as before

@Enter-tainer Enter-tainer merged commit e01492c into main Feb 17, 2024
@Enter-tainer Enter-tainer deleted the mgt/sensitive-scale branch February 17, 2024 12:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sensitive scrolling Zooming in the preview window is too sensitive using MacBook trackpad

2 participants