Skip to content

Fix: Viewport coords normalized w.r.t. full page

Gerd Wachsmuth requested to merge gerw/okular:fix_crop_link into release/21.04

IMHO, the coordinates in Viewport.rePos are normalized on the full page. In two functions within pageview.cpp, these were treated as coordinates on the cropped page.

This partially fixes the bug 198427 in the case that the cropping of the target pages (and the pages around the target) is known at the time the link is clicked. That is, it works if

  • One uses 'Trim To Selection'
  • One uses 'Trim To Margin' and has already viewed at the target page(s).

In the case that the cropping of the page at the target is unknown, we still end up at the wrong position. This seems to be hard to fix. One possibility would be the following:

  • if a link is clicked (i.e. within slotRealNotifyViewportChanged if smoothMove == True), we save the target viewport.
  • if a bounding box changes (PageView::notifyPageChanged), we recompute the target coordinates and issue a new movement
  • if a further user interaction arrives (how could this be checked without putting statements everywhere in pageview.cpp???), we delete the target viewport.

Merge request reports