summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/document-properties.cpp
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2014-02-22 21:37:43 +0000
committerapenner <penner@vaxxine.com>2014-02-22 21:37:43 +0000
commitb3dad97ff32d34dc38ce51ebbdc0e9555a9ce5e6 (patch)
treea5e566dee69bb630a3d64b2662aff63a2296e221 /src/ui/dialog/document-properties.cpp
parentFix 'preserveAspectRatio' attribute of bitmap images in EMF/WMF import/export... (diff)
downloadinkscape-b3dad97ff32d34dc38ce51ebbdc0e9555a9ce5e6.tar.gz
inkscape-b3dad97ff32d34dc38ce51ebbdc0e9555a9ce5e6.zip
offset of viewBox on document unit change (Bug 1280684)
Fixed bugs: - https://launchpad.net/bugs/1280684 (bzr r13050)
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
-rw-r--r--src/ui/dialog/document-properties.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index d344fb1d6..0411c789c 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1734,8 +1734,14 @@ void DocumentProperties::onDocUnitChange()
prefs->setBool("/options/transform/gradient", true);
{
ShapeEditor::blockSetItem(true);
+ gdouble viewscale = doc->getWidth().value("px")/doc->getRoot()->viewBox.width();
+ if (doc->getHeight().value("px")/doc->getRoot()->viewBox.height() < viewscale)
+ viewscale = doc->getHeight().value("px")/doc->getRoot()->viewBox.height();
gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
- doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(-viewscale*doc->getRoot()->viewBox.min()[Geom::X] +
+ (doc->getWidth().value("px") - viewscale*doc->getRoot()->viewBox.width())/2,
+ viewscale*doc->getRoot()->viewBox.min()[Geom::Y] +
+ (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2));
ShapeEditor::blockSetItem(false);
}
prefs->setBool("/options/transform/stroke", transform_stroke);