Bug 498038 - Mouse wheel behavior beyond document limits in Okular
Summary: Mouse wheel behavior beyond document limits in Okular
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 24.12.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-29 20:51 UTC by Jose
Modified: 2025-01-02 22:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Okular view confguration (47.03 KB, image/png)
2025-01-02 20:25 UTC, Jose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jose 2024-12-29 20:51:45 UTC
SUMMARY
Okular stores the forward and backward movements of the mouse wheel beyond the limits of the displayed document. If we are on the first page of a document and scroll back 15 pages using the mouse wheel, the wheel will not scroll forward until those 15 pages have been recovered. This effect is more noticeable when the mouse wheel operates step by step, but it can be observed with any mouse.

STEPS TO REPRODUCE
1 - Open a PDF document in Okular.
2 - Use the mouse wheel to scroll up until reaching page 0, then continue scrolling up (attempt to go to page -1 multiple times).
3 - After several upward scrolls beyond the document's first page, attempt to scroll down to page 2 using the mouse wheel.

OBSERVED RESULT
Okular remains on page 0 and does not advance to the next pages until the buffer of previous back-scroll actions is exhausted.

EXPECTED RESULT
Okular go to page 1 intermediately.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 6.2
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
It has been observed with several mouses and with a laptop touch pad.
Comment 1 Albert Astals Cid 2024-12-30 15:55:55 UTC
hmm, can not reproduce, are you using continuous view or not?

Maybe you can upload a video/gif to imgur (or some other service) so we can see it happening live?

Are you on X11 or Wayland? If wayland can you see if you can reproduce it in X11?
Comment 2 Jose 2025-01-02 20:25:40 UTC
Created attachment 177055 [details]
Okular view confguration

It occurs in X11 and in Wayland.

The view configuration of Okular is:
- Fit page
- Single page
Comment 3 Albert Astals Cid 2025-01-02 22:02:54 UTC
Git commit caedb89a513fc204e13f5b384e8ed236bbcb3bfa by Albert Astals Cid, on behalf of Kai Shen.
Committed on 02/01/2025 at 22:02.
Pushed by aacid into branch 'master'.

Fix scroll down/up at the last/first page in single page, non-continuous mode

## The bug I encountered

In single page, non-continuous mode, open a PDF file. If you scroll up at the first page and then scroll down, the document will not go to the second page. The same when scroll down at the last page and then scroll up.

## What did I find

I find that, the code in `part/pageview.cpp:3271-3299` uses `singlePageWheelAccumulatedDelta` to accumulate the scroll behavior. But if we scroll up at the first page, the data will be accumulated positive. And then, if we scroll down, the data will go back to zero first, and then we can turn to the next page with another 'scroll down' event.

## What did I do

I just **clear the accumulated data** when it is enough to perform 'a real scroll', even if the target page is invalid (such as the previous page of the first page).

M  +24   -20   part/pageview.cpp

https://invent.kde.org/graphics/okular/-/commit/caedb89a513fc204e13f5b384e8ed236bbcb3bfa
Comment 4 Albert Astals Cid 2025-01-02 22:03:47 UTC
Git commit 9f37dd5d9b7e7b2023bb511c191d45870c2117d4 by Albert Astals Cid, on behalf of Kai Shen.
Committed on 02/01/2025 at 22:03.
Pushed by aacid into branch 'release/24.12'.

Fix scroll down/up at the last/first page in single page, non-continuous mode

## The bug I encountered

In single page, non-continuous mode, open a PDF file. If you scroll up at the first page and then scroll down, the document will not go to the second page. The same when scroll down at the last page and then scroll up.

## What did I find

I find that, the code in `part/pageview.cpp:3271-3299` uses `singlePageWheelAccumulatedDelta` to accumulate the scroll behavior. But if we scroll up at the first page, the data will be accumulated positive. And then, if we scroll down, the data will go back to zero first, and then we can turn to the next page with another 'scroll down' event.

## What did I do

I just **clear the accumulated data** when it is enough to perform 'a real scroll', even if the target page is invalid (such as the previous page of the first page).
(cherry picked from commit caedb89a513fc204e13f5b384e8ed236bbcb3bfa)

M  +24   -20   part/pageview.cpp

https://invent.kde.org/graphics/okular/-/commit/9f37dd5d9b7e7b2023bb511c191d45870c2117d4