summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2015-01-29 00:03:12 +0000
committerapenner <penner@vaxxine.com>2015-01-29 00:03:12 +0000
commita8ef610e1960c0e0d61f417471e8d2c32b51db9a (patch)
tree3df9c2794f81cd12db056d6acb6a1540729a6bcb /src/display
parentFix for Bug #437567 (PDF Save As dialog convert text to paths option is confu... (diff)
downloadinkscape-a8ef610e1960c0e0d61f417471e8d2c32b51db9a.tar.gz
inkscape-a8ef610e1960c0e0d61f417471e8d2c32b51db9a.zip
for snapping to grids and guides, reduce numerical error for the case of uniform scaling of viewbox
(bzr r13881)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-axonomgrid.cpp5
-rw-r--r--src/display/canvas-grid.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 05ba71a49..ac93f5c88 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -220,6 +220,11 @@ CanvasAxonomGrid::readRepr()
if( root->viewBox_set ) {
scale_x = root->width.computed / root->viewBox.width();
scale_y = root->height.computed / root->viewBox.height();
+ if (Geom::are_near(scale_x / scale_y, 1.0, Geom::EPSILON)) {
+ // scaling is uniform, try to reduce numerical error
+ scale_x = (scale_x + scale_y)/2.0;
+ scale_y = scale_x;
+ }
}
gchar const *value;
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 1a284b46e..0a43ed8b7 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -544,6 +544,11 @@ CanvasXYGrid::readRepr()
if( root->viewBox_set ) {
scale_x = root->width.computed / root->viewBox.width();
scale_y = root->height.computed / root->viewBox.height();
+ if (Geom::are_near(scale_x / scale_y, 1.0, Geom::EPSILON)) {
+ // scaling is uniform, try to reduce numerical error
+ scale_x = (scale_x + scale_y)/2.0;
+ scale_y = scale_x;
+ }
}
gchar const *value;