summaryrefslogtreecommitdiffstats
path: root/src/sp-guide.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-02-01 10:48:53 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-02-01 10:48:53 +0000
commit3581010e2f7021167ba0f4e577e0b3f8da2944b6 (patch)
treee6644dc31e58d21ff60a9ae7fe121287071e5566 /src/sp-guide.cpp
parentCreate a empty LPE (diff)
parentLatvian translation update (diff)
downloadinkscape-3581010e2f7021167ba0f4e577e0b3f8da2944b6.tar.gz
inkscape-3581010e2f7021167ba0f4e577e0b3f8da2944b6.zip
Effect done
(bzr r13879.1.2)
Diffstat (limited to 'src/sp-guide.cpp')
-rw-r--r--src/sp-guide.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 890c1f597..08b055508 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -156,8 +156,15 @@ void SPGuide::set(unsigned int key, const gchar *value) {
// If root viewBox set, interpret guides in terms of viewBox (90/96)
SPRoot *root = document->getRoot();
if( root->viewBox_set ) {
- newx = newx * root->width.computed / root->viewBox.width();
- newy = newy * root->height.computed / root->viewBox.height();
+ if(Geom::are_near((root->width.computed * root->viewBox.height()) / (root->viewBox.width() * root->height.computed), 1.0, Geom::EPSILON)) {
+ // for uniform scaling, try to reduce numerical error
+ double vbunit2px = (root->width.computed / root->viewBox.width() + root->height.computed / root->viewBox.height())/2.0;
+ newx = newx * vbunit2px;
+ newy = newy * vbunit2px;
+ } else {
+ newx = newx * root->width.computed / root->viewBox.width();
+ newy = newy * root->height.computed / root->viewBox.height();
+ }
}
this->point_on_line = Geom::Point(newx, newy);
} else if (success == 1) {