diff options
Diffstat (limited to 'src/display/canvas-grid.cpp')
| -rw-r--r-- | src/display/canvas-grid.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 1a284b46e..9b9f64529 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -35,7 +35,7 @@ #include "ui/widget/registered-widget.h" #include "desktop.h" #include "sp-canvas-util.h" -#include "util/mathfns.h" +#include "helper/mathfns.h" #include "display/cairo-utils.h" #include "display/canvas-axonomgrid.h" @@ -50,7 +50,7 @@ #include "sp-root.h" #include "svg/svg-color.h" #include "svg/stringstream.h" -#include "util/mathfns.h" +#include "helper/mathfns.h" #include "xml/node-event-vector.h" #include "verbs.h" #include "display/sp-canvas.h" @@ -544,6 +544,14 @@ 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; + double scale_none = Inkscape::Util::Quantity::convert(1, doc->getDisplayUnit(), "px"); + if (Geom::are_near(scale_x / scale_none, 1.0, Geom::EPSILON)) + scale_x = scale_none; // objects are same size, reduce numerical error + scale_y = scale_x; + } } gchar const *value; |
