summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-03-14 10:17:48 +0000
committertavmjong-free <tavmjong@free.fr>2017-03-14 10:17:48 +0000
commit02c5ac41e41fb335cd2946bfbb9e418a9116ba48 (patch)
tree26bdead6e7cd0208018fee00316c99ab155fcf4f /src
parentFix zoom reference point when using desktop's zoom widget. (diff)
downloadinkscape-02c5ac41e41fb335cd2946bfbb9e418a9116ba48.tar.gz
inkscape-02c5ac41e41fb335cd2946bfbb9e418a9116ba48.zip
Add functions to rotate drawing inside desktop.
(bzr r15595)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp42
-rw-r--r--src/desktop.h5
2 files changed, 47 insertions, 0 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index ddd5dfe83..f33c2bc29 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -1086,6 +1086,48 @@ SPDesktop::zoom_grab_focus()
/**
+ * Rotate keeping the point 'c' fixed in the desktop window.
+ */
+void
+SPDesktop::rotate_absolute_keep_point (Geom::Point const &c, double rotate)
+{
+ Geom::Point w = d2w( c ); // Must be before rotate changed.
+ _current_affine.setRotate( rotate );
+ set_display_area( c, w );
+}
+
+
+void
+SPDesktop::rotate_relative_keep_point (Geom::Point const &c, double rotate)
+{
+ Geom::Point w = d2w( c ); // Must be before rotate changed.
+ _current_affine.addRotate( rotate );
+ set_display_area( c, w );
+}
+
+
+/**
+ * Rotate aligning the point 'c' to the center of desktop window.
+ */
+void
+SPDesktop::rotate_absolute_center_point (Geom::Point const &c, double rotate)
+{
+ _current_affine.setRotate( rotate );
+ Geom::Rect viewbox = canvas->getViewbox();
+ set_display_area( c, viewbox.midpoint() );
+}
+
+
+void
+SPDesktop::rotate_relative_center_point (Geom::Point const &c, double rotate)
+{
+ _current_affine.addRotate( rotate );
+ Geom::Rect viewbox = canvas->getViewbox();
+ set_display_area( c, viewbox.midpoint() );
+}
+
+
+/**
* Scroll canvas by to a particular point (window coordinates).
*/
void
diff --git a/src/desktop.h b/src/desktop.h
index 2d2297c6b..3dc11b557 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -346,6 +346,11 @@ public:
void zoom_grab_focus();
+ void rotate_absolute_keep_point (Geom::Point const &c, double const rotate);
+ void rotate_relative_keep_point (Geom::Point const &c, double const rotate);
+ void rotate_absolute_center_point (Geom::Point const &c, double const rotate);
+ void rotate_relative_center_point (Geom::Point const &c, double const rotate);
+
void scroll_absolute (Geom::Point const &point, bool is_scrolling = false);
void scroll_relative (Geom::Point const &delta, bool is_scrolling = false);
void scroll_relative_in_svg_coords (double dx, double dy, bool is_scrolling = false);