Bug 421755

Summary: The two finger touchscreen gesture to zoom in out (pinch in/pinch out) results in the document to scroll by a large amount.
Product: [Applications] okular Reporter: spittingverse <spittingverse>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: 842mono, apandada1, dzackgarza, eliottt-m, jan.claussen10, jk, micraft.b, nate, oliver.sander, stefan.bruens
Priority: NOR Keywords: usability
Version: 1.10.1   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=159408
Latest Commit: Version Fixed In: 23.08
Sentry Crash Report:
Attachments: Video displaying how the two finger pinch scrolls and zooms, rather than just zoom.
Confirmed zooming issue

Description spittingverse@gmail.com 2020-05-19 05:52:05 UTC
Created attachment 128596 [details]
Video displaying how the two finger pinch scrolls and zooms, rather than just zoom.

SUMMARY
The two finger touchscreen gesture to zoom in out (pinch in/pinch out) results in the document to scroll by a large amount.

STEPS TO REPRODUCE
1. Open document (tested with pdf and epub)
2. pinch in or pinch out with touchscreen

OBSERVED RESULT
The document scrolls by a lot

EXPECTED RESULT
Document should not scroll, and the behavior should mimic the ctrl + touchpad scroll, which works fine.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: manjaro?
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Comment 1 Josef Kufner 2020-05-25 10:21:34 UTC
The problem is that the document does not pan when zooming. The code that handles mouse wheel zoom should be used for the pinch zoom too. The viewport position must be updated while zooming to maintain relative position of the mouse cursor (pinch zoom center) and the document.
Comment 2 Oliver Sander 2020-05-25 10:35:57 UTC
Should be fixed by https://invent.kde.org/graphics/okular/-/merge_requests/134
Comment 3 Eliott 2020-06-03 18:09:59 UTC
I have the exact same issue (on KDE Manjaro, Okular 1.10.1).
Comment 4 Zack 2020-07-12 03:06:40 UTC
Same issue here, on Arch Linux, and the linked merge request seems to still be open. I am currently running version 1.10.70 under Xorg, and this seems to be a new issue that was introduced sometime earlier this year for me. 

Is there any way to work around this issue while the merge is under review? Maybe rolling back to some previous version in the meantime?
Comment 5 Zack 2020-07-12 03:07:34 UTC
Created attachment 130053 [details]
Confirmed zooming issue
Comment 6 Nate Graham 2020-09-18 21:31:14 UTC
*** Bug 426679 has been marked as a duplicate of this bug. ***
Comment 7 Bernhard 2021-01-17 15:38:32 UTC
I can confirm this still is the case in 20.12.1 on X11:

Okular always zooms as if both fingers were in the upper left corner on the first page of the document, no the page you are on. This means that zooming works mostly fine on the first page, but if you want to zoom to 2x on page 100 you will find yourself on page 50.
Note that this only happens with touch, middle mouse or crtl+scroll don't do that.
Comment 8 Nate Graham 2021-01-19 15:16:39 UTC
*** Bug 390707 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2021-01-19 15:16:46 UTC
*** Bug 429197 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2021-01-19 15:55:15 UTC
Actually it's the opposite: this bug and its dupes are all dupes of 159408. I've tested the MR and it fixes them all.

*** This bug has been marked as a duplicate of bug 159408 ***
Comment 11 Nicolas Fella 2023-07-08 12:42:32 UTC
Git commit db68662372984e643184a6d1f8eb63e519e2646d by Nicolas Fella.
Committed on 08/07/2023 at 12:04.
Pushed by nicolasfella into branch 'master'.

Avoid accidental scrolling when performing pinch gesture

When starting a pinch the user first touches with one finger. That causes the QScroller to enter the pressed state.
Then when the second finger touches and moves this causes the QScroller to interpret it as a scroll. This causes
the view position of the document to move

To avoid this send InputRelease to the scroller when a pinch starts to make sure it is no longer in pressed state.
Also don't send any input to the scroller while the pinch is ongoing to avoid it entering the pressed state again.

M  +19   -4    part/pageview.cpp

https://invent.kde.org/graphics/okular/-/commit/db68662372984e643184a6d1f8eb63e519e2646d
Comment 12 Nate Graham 2023-07-22 05:20:35 UTC
*** Bug 470289 has been marked as a duplicate of this bug. ***