summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/document-properties.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-09-01 23:55:58 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-09-01 23:55:58 +0000
commitf85dfb19c10b0345859964066eb7fce49d275c49 (patch)
tree29ac681cf0f68f9ffb623b59a9b6a5b6e31d3709 /src/ui/dialog/document-properties.cpp
parentosx-app.sh: test awk and require gawk if too old (diff)
parentBinReloc: fix -Wwrite-strings (diff)
downloadinkscape-f85dfb19c10b0345859964066eb7fce49d275c49.tar.gz
inkscape-f85dfb19c10b0345859964066eb7fce49d275c49.zip
update to trunk (r13538)
(bzr r13506.1.48)
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
-rw-r--r--src/ui/dialog/document-properties.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 4e4616724..2757a0ec9 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1736,9 +1736,13 @@ void DocumentProperties::onDocUnitChange()
prefs->setBool("/options/transform/gradient", true);
{
ShapeEditor::blockSetItem(true);
- gdouble viewscale_w = doc->getWidth().value("px")/doc->getRoot()->viewBox.width();
- gdouble viewscale_h = doc->getHeight().value("px")/doc->getRoot()->viewBox.height();
- gdouble viewscale = std::min(viewscale_h, viewscale_w);
+ gdouble viewscale = 1.0;
+ Geom::Rect vb = doc->getRoot()->viewBox;
+ if ( !vb.hasZeroArea() ) {
+ gdouble viewscale_w = doc->getWidth().value("px") / vb.width();
+ gdouble viewscale_h = doc->getHeight().value("px")/ vb.height();
+ viewscale = std::min(viewscale_h, viewscale_w);
+ }
gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
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,