Bug 436742 - Involuntary scrolling when annotations encounter edge of page
Summary: Involuntary scrolling when annotations encounter edge of page
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 20.12.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-07 16:49 UTC by pbs3141
Modified: 2022-11-15 14:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
gif animation showing steps to reproduce (2.22 MB, image/gif)
2021-05-07 22:36 UTC, pbs3141
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pbs3141 2021-05-07 16:49:17 UTC
SUMMARY

When the user hits the edge of the page while drawing an annotation, or attempts to drag an annotation off the edge of the page, the page scrolls up or down.

STEPS TO REPRODUCE

Open a pdf document with many pages, and scroll to a page somewhere about the middle. Then either

1. Draw an annotation so that part of it would go off the edge of the page.
2. Attempt to drag an existing annotation off the page.

OBSERVED RESULT

Depending on the type of annotation, which edge was hit, and sometimes even which edge was hit first, the following can happen:

1. After drawing the annotation, the page scrolls upwards or downwards a small amount.
2. While dragging the annotation, the page continuously scrolls up or down.

EXPECTED RESULT

Scrolling should only occur if the edge of the viewport are hit, and be limited to the current page.
Comment 1 Albert Astals Cid 2021-05-07 21:44:39 UTC
I am not sure if i understand what you mean, could you record a gif screencast with peek and attach it here ?
Comment 2 pbs3141 2021-05-07 22:36:08 UTC
Created attachment 138231 [details]
gif animation showing steps to reproduce
Comment 3 Bug Janitor Service 2022-10-16 21:41:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/664
Comment 4 Oliver Sander 2022-11-15 14:34:03 UTC
Git commit e6002e798d06cf52a71d9d35716c4d0b9c282d99 by Oliver Sander, on behalf of Nikola Nikolic.
Committed on 15/11/2022 at 13:30.
Pushed by sander into branch 'master'.

Fix: Involuntary scrolling when annotations encounter the edge of the page

There are three reasons why scrolling happens (first two cases of scrolling are actually due to
viewport transition that is triggered by annotation being traslated/created):

1. VisiblePageRect are NormalizedRect and should be represented by four values in [0, 1] interval.
   Due to rounding errors caused by using QRect, they only reach the [0, 0.999] interval.
   That means that right and bottom edge of the page are never visible so if annotation
   is translated along the right/bottom edge viewport transition occurs (fixed in
   PageView::slotRequestVisiblePixmaps)

2. For freehand line there are some constants (dX, dY) that make a line to be drawn outside
   the page borders causing viewport transition. Removing these constants solves the problem (fixed
   in SmoothPathEngine::event)

3. Browse mode is activated as soon as the cursor is moved outside the viewport.
   Instead, we should forward the move event to the annotation which than can ignore the event (fixed
   in PageView::mouseMoveEvent)

M  +8    -10   part/annotationtools.cpp
M  +11   -6    part/pageview.cpp

https://invent.kde.org/graphics/okular/commit/e6002e798d06cf52a71d9d35716c4d0b9c282d99