summaryrefslogtreecommitdiffstats
path: root/src/viewbox.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-01-17 17:14:33 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-01-17 17:14:33 +0000
commita1b0c49b10eeb43a8d9c25c85c5668776939e39d (patch)
tree57d7f6513371a5ffbd71bc4f0c96f1b2ea63644b /src/viewbox.cpp
parentadding Kaleidoscope (diff)
parentDocumentation. New Galician translation of the Shapes tutorial by Leandro Reg... (diff)
downloadinkscape-a1b0c49b10eeb43a8d9c25c85c5668776939e39d.tar.gz
inkscape-a1b0c49b10eeb43a8d9c25c85c5668776939e39d.zip
update to trunk
(bzr r13708.1.9)
Diffstat (limited to 'src/viewbox.cpp')
-rw-r--r--src/viewbox.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/viewbox.cpp b/src/viewbox.cpp
index 662b05686..95a167109 100644
--- a/src/viewbox.cpp
+++ b/src/viewbox.cpp
@@ -175,7 +175,9 @@ void SPViewBox::apply_viewbox(const Geom::Rect& in) {
/* Things are getting interesting */
double scalex = in.width() / ((float) this->viewBox.width());
double scaley = in.height() / ((float) this->viewBox.height());
- double scale = (this->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley);
+ double scale = (scalex + scaley)/2.0; // default if aspect ratio is not changing
+ if (!Geom::are_near(scalex / scaley, 1.0, Geom::EPSILON))
+ scale = (this->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley);
width = this->viewBox.width() * scale;
height = this->viewBox.height() * scale;