summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/document-properties.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-09-02 20:46:51 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-09-02 20:46:51 +0000
commit7dc3de280a82ce03f1f4860bc1a523792b376f5d (patch)
treeb7e27f61b09b40dcabd9502d1009f346162bf6d4 /src/ui/dialog/document-properties.cpp
parentHeader cleanup: stop using Glib types where they aren't truly needed. Eases G... (diff)
parentFix locale issue in powerstroke width selection (diff)
downloadinkscape-7dc3de280a82ce03f1f4860bc1a523792b376f5d.tar.gz
inkscape-7dc3de280a82ce03f1f4860bc1a523792b376f5d.zip
Update to trunk r13542
(bzr r13341.1.191)
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 5ad82644e..2a3a1dd86 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,