From 4b34a53a8122919e53ce2e13627e2007fafec0db Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 23 Jan 2015 15:39:50 -0500 Subject: improved precision in placing grids and guides. (Bug 1373311) Fixed bugs: - https://launchpad.net/bugs/1373311 (bzr r13868) --- src/ui/widget/registered-widget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui/widget/registered-widget.cpp') diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index bbf542987..298377af3 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -245,7 +245,10 @@ RegisteredScalarUnit::on_value_changed() if (doc) { SPRoot *root = doc->getRoot(); if (root->viewBox_set) { - if (_user_units == RSU_x) { + // check to see if scaling is uniform + if(Geom::are_near((root->viewBox.width() * root->height.computed) / (root->width.computed * root->viewBox.height()), 1.0, Geom::EPSILON)) { + scale = (root->viewBox.width() / root->width.computed + root->viewBox.height() / root->height.computed)/2.0; + } else if (_user_units == RSU_x) { scale = root->viewBox.width() / root->width.computed; } else { scale = root->viewBox.height() / root->height.computed; -- cgit v1.2.3