diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-01-24 09:58:32 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-01-24 09:58:32 +0000 |
| commit | e670856c8810c2733ce95e5f31c822cf20030367 (patch) | |
| tree | ff3d2c135a871bf5a66a066ee8bd58fa602559cd /src/sp-guide.cpp | |
| parent | Added the remove for outer staff to kaleidoscope (diff) | |
| parent | * [INTL:sk] Slovak translation update (diff) | |
| download | inkscape-e670856c8810c2733ce95e5f31c822cf20030367.tar.gz inkscape-e670856c8810c2733ce95e5f31c822cf20030367.zip | |
update to trunk
(bzr r13708.1.13)
Diffstat (limited to 'src/sp-guide.cpp')
| -rw-r--r-- | src/sp-guide.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 3eecb2783..890c1f597 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -198,8 +198,15 @@ SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::P SPRoot *root = doc->getRoot(); if( root->viewBox_set ) { - newx = newx * root->viewBox.width() / root->width.computed; - newy = newy * root->viewBox.height() / root->height.computed; + // 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)) { + double px2vbunit = (root->viewBox.width()/root->width.computed + root->viewBox.height()/root->height.computed)/2.0; + newx = newx * px2vbunit; + newy = newy * px2vbunit; + } else { + newx = newx * root->viewBox.width() / root->width.computed; + newy = newy * root->viewBox.height() / root->height.computed; + } } sp_repr_set_point(repr, "position", Geom::Point( newx, newy )); @@ -341,8 +348,15 @@ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit) SPRoot *root = document->getRoot(); if( root->viewBox_set ) { - newx = newx * root->viewBox.width() / root->width.computed; - newy = newy * root->viewBox.height() / root->height.computed; + // 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)) { + double px2vbunit = (root->viewBox.width()/root->width.computed + root->viewBox.height()/root->height.computed)/2.0; + newx = newx * px2vbunit; + newy = newy * px2vbunit; + } else { + newx = newx * root->viewBox.width() / root->width.computed; + newy = newy * root->viewBox.height() / root->height.computed; + } } //XML Tree being used here directly while it shouldn't be. |
