summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-03-13 14:22:22 +0000
committertavmjong-free <tavmjong@free.fr>2017-03-13 14:22:22 +0000
commit014489163050d8abe9e5c4949fb80f3c21b1c17b (patch)
tree7cbeb87aa023d563986b32f65fd500c6072ee86a /src/display
parentTwo Extensions for converting objects to paths before exporting. (Bug 1662531) (diff)
downloadinkscape-014489163050d8abe9e5c4949fb80f3c21b1c17b.tar.gz
inkscape-014489163050d8abe9e5c4949fb80f3c21b1c17b.zip
Replace rectangle based zooming by affine based zooming.
This allows a rotation to be included in the drawing to window mapping. General code cleanup. Added documentation. Any change to zooming behavior is probably a bug. (bzr r15592)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-grid.cpp4
-rw-r--r--src/display/sp-canvas.cpp8
-rw-r--r--src/display/sp-canvas.h4
3 files changed, 12 insertions, 4 deletions
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index cf7d04555..2dadde336 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -841,7 +841,9 @@ void
CanvasXYGrid::Update (Geom::Affine const &affine, unsigned int /*flags*/)
{
ow = origin * affine;
- sw = spacing * affine;
+ // Temp hack to insure grid doesn't collapse with rotation.
+ sw[0] = spacing[0] * sqrt(affine[0]*affine[0] + affine[1]*affine[1]);
+ sw[1] = spacing[1] * sqrt(affine[2]*affine[2] + affine[3]*affine[3]);
sw -= Geom::Point(affine[4], affine[5]);
for(int dim = 0; dim < 2; dim++) {
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 9cc9e51a2..61602e880 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1937,10 +1937,16 @@ double start_angle = 0;
bool started = false;
bool rotated = false;
-void SPCanvas::scrollTo(double cx, double cy, unsigned int clear, bool is_scrolling)
+/**
+ * Scroll screen to point 'c'. 'c' is measured in screen pixels.
+ */
+void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrolling)
{
GtkAllocation allocation;
+ double cx = c[Geom::X];
+ double cy = c[Geom::Y];
+
int ix = (int) round(cx); // ix and iy are the new canvas coordinates (integer screen pixels)
int iy = (int) round(cy); // cx might be negative, so (int)(cx + 0.5) will not do!
int dx = ix - _x0; // dx and dy specify the displacement (scroll) of the
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 21b6760f2..708653bdf 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -70,8 +70,8 @@ GType sp_canvas_get_type() G_GNUC_CONST;
* Port of GnomeCanvas for inkscape needs.
*/
struct SPCanvas {
- /// Scrolls canvas to specific position (cx and cy are measured in screen pixels).
- void scrollTo(double cx, double cy, unsigned int clear, bool is_scrolling = false);
+ /// Scrolls canvas to specific position (c is measured in screen pixels).
+ void scrollTo(Geom::Point const &c, unsigned int clear, bool is_scrolling = false);
void startRotateTo(double angle);
void rotateTo(double angle);
bool endRotateTo();