From a8ef610e1960c0e0d61f417471e8d2c32b51db9a Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Wed, 28 Jan 2015 19:03:12 -0500 Subject: for snapping to grids and guides, reduce numerical error for the case of uniform scaling of viewbox (bzr r13881) --- src/display/canvas-grid.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/display/canvas-grid.cpp') 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; -- cgit v1.2.3