Closed Enter-tainer closed 9 months ago
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.
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
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.
does mouse use line mode? i dont have a mouse at this moment
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
does mouse use line mode? i dont have a mouse at this moment
I don't have one either. :crying_cat_face: :smile_cat:
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.
I just test this with my mouse and it works the same as before
fix #238 fix #208
I just randomly choose a threshold, and currently I don't have a mouse. Please test!