Difference between revisions of "Rotating Canvas"

From Inkscape Wiki
Jump to: navigation, search
(Steps)
(Steps)
 
(7 intermediate revisions by the same user not shown)
Line 9: Line 9:
  
 
* Adapt current zooming code to work if _w2d includes a rotation.
 
* Adapt current zooming code to work if _w2d includes a rotation.
** New function: SPDesktop::set_display_area() that takes as input:
+
** ✔New function: SPDesktop::set_display_area() that takes as input:
 
*** The current transformation (_w2d).
 
*** The current transformation (_w2d).
 
*** A point on the drawing and a point on the screen which are to be aligned.
 
*** A point on the drawing and a point on the screen which are to be aligned.
** All basic zooming functions can be handled as special cases of this new function.
+
** ✔All basic zooming functions can be handled as special cases of this new function.
** Update/replace all instances of set_display_area() to use new version.
+
** ✔Update/replace all instances of set_display_area() to use new version.
** Replace all instances of get_display_area() to handle rotated frame.
+
** Replace all instances of get_display_area() to handle rotated frame. Not needed?
* Add rotation functions that follows the zoom functions pattern.
+
* ✔Add rotation functions that follows the zoom functions pattern.
 
* Add GUI to set rotation.
 
* Add GUI to set rotation.
** Menu items with keyboard shortcuts.
+
** ✔Desktop scroll widget.
** On-screen editing tools using a class derived from SPCanvasItem.
+
** Menu items with keyboard shortcuts.(?)
 +
** ✔Shift-Control-Scroll (matches Control-Scroll for zoom).
 +
** ✔Preference for rotation step size.
 +
** ✔On-screen editing tools using a class derived from SPCanvasItem. Use Ctrl-Middle Mouse to activate.
 
** Fix problems (see below).
 
** Fix problems (see below).
  
 
== Problems ==
 
== Problems ==
  
* The tools (Rectangle, Path, etc.) seem to already work when _w2d includes a rotation.
+
* ✔The tools (Rectangle, Path, etc.) seem to already work when _w2d includes a rotation.
 
* On screen elements need to be transformed.
 
* On screen elements need to be transformed.
** Guides (already shown at correct angles but ends are in wrong places.
+
** ✔Guides (already shown at correct angles but ends are in wrong places.
 
** Grids
 
** Grids
** Bounding boxes
+
*** ✔XY
** Page outline
+
*** Axiometric
* Scrolling needs to be adjusted (it should work using the center of the drawing).
+
** ✔Bounding boxes (CtrlRect)
 +
** ✔Page outline (CtrlRect)
 +
** Arrow handles for resize, skew, ...
 +
* ✔Scrolling needs to be adjusted.

Latest revision as of 06:16, 2 April 2017

Being able to rotate the canvas while working on a drawing is a highly desirable feature. Unfortunately, most of Inkscape's code assumes a non-rotating canvas.

Basic Strategy

The Inkscape SPDesktop class's Geom::Affine _w2d variable defines the Window to Desktop coordinate transformation (and _d2w defines the inverse). In 0.92.x _w2d is limited to scaling. Rotating the canvas can be added to this variable. It might also be possible to add translation (to handle scrolling) as well.

Steps

  • Adapt current zooming code to work if _w2d includes a rotation.
    • ✔New function: SPDesktop::set_display_area() that takes as input:
      • The current transformation (_w2d).
      • A point on the drawing and a point on the screen which are to be aligned.
    • ✔All basic zooming functions can be handled as special cases of this new function.
    • ✔Update/replace all instances of set_display_area() to use new version.
    • Replace all instances of get_display_area() to handle rotated frame. Not needed?
  • ✔Add rotation functions that follows the zoom functions pattern.
  • Add GUI to set rotation.
    • ✔Desktop scroll widget.
    • Menu items with keyboard shortcuts.(?)
    • ✔Shift-Control-Scroll (matches Control-Scroll for zoom).
    • ✔Preference for rotation step size.
    • ✔On-screen editing tools using a class derived from SPCanvasItem. Use Ctrl-Middle Mouse to activate.
    • Fix problems (see below).

Problems

  • ✔The tools (Rectangle, Path, etc.) seem to already work when _w2d includes a rotation.
  • On screen elements need to be transformed.
    • ✔Guides (already shown at correct angles but ends are in wrong places.
    • Grids
      • ✔XY
      • Axiometric
    • ✔Bounding boxes (CtrlRect)
    • ✔Page outline (CtrlRect)
    • Arrow handles for resize, skew, ...
  • ✔Scrolling needs to be adjusted.