Review Request 127366: Resize annotations

Tobias Deiminger haxtibal at t-online.de
Sun Nov 13 21:18:15 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127366/
-----------------------------------------------------------

(Updated Nov. 13, 2016, 9:18 p.m.)


Review request for Okular.


Changes
-------

Rebase on the Frameworks-merged master. Additioally, fix selection handling for non-rectangular shaped annotations (like ellipse).


Bugs: 177778
    http://bugs.kde.org/show_bug.cgi?id=177778


Repository: okular


Description (updated)
-------

This diff adds an annotation resize feature to okular (see Bug 177778).

Usage:
If you left-click at an annotation, it gets selected and 8 resize handles appear on the corners/edges of the selection rectangle. When cursor is moved over one of the handles, the cursor shape indicates resize mode (everywhere else on the annotation means "move", just as it was before resize feature was added). Press ESC, or click an area outside the annotation to cancel selection. Feature is only applicable for annotation types AText, AStamp and AGeom.

Notable changes:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change, similar to the existing move functionality.
-Separated annotation state handling out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp)
-Added method Document::adjustPageAnnotation, backed by a QUndoCommand class Okular::AdjustAnnotationCommand
-Added method Annotation::adjust
-Draw resize handles and selection boundary in MouseAnnotation::routePaint
-Draw only a bounding rectangle during resize, if annotation is rendered externally
Some functionality unrelated to the resize feature is also shifted to class MouseAnnotation, to establish a single place of responsibility for annotation interactions.

Known Bugs:
-A comment annotation (subtype 1) with embedded appearance can be selected for resize. But the resize changes only the selection rectangle, while the annotation is rendered unchanged.
-AWidget (subtype 13) can be selected for move and resize, but nothing happens when performing those actions.

TODO:
-Consider z-Order for overlapping annotations? (currently, selection rectangle is always drawn on top, while the related annotation may be in background).
-Provide a PDF document with suitable content, where supported annotation types and and possible regressions can be tested.
-Add test cases once requirements are fixed.


Diffs (updated)
-----

  CMakeLists.txt 9810c9bb552cc3da9cf694fdb61fd22471bad955 
  autotests/translateannotationtest.cpp 9fda65d50342a8c91df88f9feb4a54413f5819e3 
  core/annotations.h 5653097fe892ce57c8e81615a1c20217e538e1de 
  core/annotations.cpp c95fe877316398a5341e29146379dd231dfa40c7 
  core/annotations_p.h 07b124a4fae40b7a983aa382ae824125e6d25746 
  core/document.h bac38f89f85980d478e6252ecc8dc823cbe4359a 
  core/document.cpp ff9253acb2f533c67eb48c85a1cadbbdce1f5ef6 
  core/document_p.h ef4dda60e9cea272b23b15e2bef84da9d9bfb0ac 
  core/documentcommands.cpp aafc45a1a989a7240520f2168e253d51d6744f7c 
  core/documentcommands_p.h 616999dd68406590b304cf648878fa8acb3ec6e0 
  generators/poppler/annots.cpp df67986adc076f722e601c3bea187200ecf9df31 
  ui/pagepainter.cpp db82119ca399f4b93798198ea92a04bf8e5cfeee 
  ui/pageview.cpp b116b36a0de494f150a1e9fbaadd86a2bad3d6c3 
  ui/pageviewmouseannotation.h PRE-CREATION 
  ui/pageviewmouseannotation.cpp PRE-CREATION 

Diff: https://git.reviewboard.kde.org/r/127366/diff/


Testing
-------

Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)

Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed

Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.

Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".


Thanks,

Tobias Deiminger

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20161113/ac054765/attachment.html>


More information about the Okular-devel mailing list