diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-18 18:08:42 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-18 18:08:42 +0000 |
| commit | 0c67c166ce5fb0e447b5c957e9222610d9d0c559 (patch) | |
| tree | d10c904aed7d23568444776bda67b76cd574b36f /src/sp-guide.cpp | |
| parent | Added kaleidoscope mode (diff) | |
| parent | Latvian translation update (diff) | |
| download | inkscape-0c67c166ce5fb0e447b5c957e9222610d9d0c559.tar.gz inkscape-0c67c166ce5fb0e447b5c957e9222610d9d0c559.zip | |
update to trunk
(bzr r13708.1.18)
Diffstat (limited to 'src/sp-guide.cpp')
| -rw-r--r-- | src/sp-guide.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 890c1f597..4e1c5913d 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -47,16 +47,6 @@ using Inkscape::DocumentUndo; using std::vector; -#include "sp-factory.h" - -namespace { - SPObject* createGuide() { - return new SPGuide(); - } - - bool guideRegistered = SPFactory::instance().registerObject("sodipodi:guide", createGuide); -} - SPGuide::SPGuide() : SPObject() , label(NULL) @@ -156,8 +146,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) { |
