summaryrefslogtreecommitdiffstats
path: root/src/display/canvas-grid.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-18 18:16:36 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-18 18:16:36 +0000
commit913372144fbee834867176885a5526d70243e4e0 (patch)
treea28957014d44a50067932243cc919f522efac898 /src/display/canvas-grid.cpp
parentupdate to trunk (diff)
parentLatvian translation update (diff)
downloadinkscape-913372144fbee834867176885a5526d70243e4e0.tar.gz
inkscape-913372144fbee834867176885a5526d70243e4e0.zip
update to trunk
(bzr r13682.1.23)
Diffstat (limited to 'src/display/canvas-grid.cpp')
-rw-r--r--src/display/canvas-grid.cpp12
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;