[okular] [Bug 334297] Highlighter of the review tool does not work correct in rotated views of the pdf document
David Hurka
bugzilla_noreply at kde.org
Thu May 30 20:48:58 BST 2019
https://bugs.kde.org/show_bug.cgi?id=334297
--- Comment #4 from David Hurka <david.hurka at mailbox.org> ---
(In reply to David Hurka from comment #3)
> Seems like Okular passes the wrong RegularAreaRect to the highlighter tool,
> a RegularAreaRect that somehow got the page rotation applied.
Experimented a bit on this. Still seems like the RegularAreaRect somehow gets
transformed with the current page rotation, when TextSelectorEngine requests
the selected page area from the page view. Actually,
TextPage::textArea(TextSelection), which is creates the RegularAreaRect does a
transformation on the RegularAreaRect, guessing the current page view rotation,
and TextSelectorEngine doesn’t expect this.
This gets visible when PagePainter is changed that it uses Quad::point(index)
instead of Quad::transformedPoint(index). Then the annotation is always
oriented the same, and correct if the page is rotated like when the annotation
was created. Only works with non-PDF documents, otherwise PagePainter is not
used.
May be easy to fix, just remove the transformation call in
TextPage::textArea().
---bit off topic---
Annotation generation is a bit strange. There are some AnnotatorEngine
subclasses, which handle mouse events etc. to create an Annotation object
containing all the needed geometry. But
PageViewAnnotator::performRouteMouseOrTabletEvents() passes them points from
the rotated page (double nX, nY). Although comments in the source code say that
(nX, nY) is a normalized point, it doesn’t simply pass a NormalizedPoint which
is independent of page rotation.
When the Annotation Object is complete, Document::addPageAnnotation() does a
baseTransform on the Annotation, to correct for page view rotation. Considering
the mentioned source code comment, this seems like a hack. And somehow, this
does not affect highlight annotations - removing the baseTransform only breaks
the other annotation tools.
@Developers: Would it make sense to refactor AnnotatorEngine stuff a bit to
work with true NormalizedPoints exclusively?
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list