From 447b514a70131ba71e507c0ef4647b9101a57113 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 12 Feb 2016 09:52:13 -0500 Subject: if viewbox does not exist, create it from page size, only if page size exists. (Bug 1544016) Fixed bugs: - https://launchpad.net/bugs/1544016 (bzr r14648) --- src/file.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 7ae7d238a..9d390908e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -142,7 +142,9 @@ SPDesktop *sp_file_new(const std::string &templ) } // Set viewBox if it doesn't exist - if (!doc->getRoot()->viewBox_set) { + if (!doc->getRoot()->viewBox_set + && (doc->getRoot()->width.unit != SVGLength::PERCENT) + && (doc->getRoot()->height.unit != SVGLength::PERCENT)) { DocumentUndo::setUndoSensitive(doc, false); doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDisplayUnit()), doc->getHeight().value(doc->getDisplayUnit()))); DocumentUndo::setUndoSensitive(doc, true); @@ -289,7 +291,9 @@ bool sp_file_open(const Glib::ustring &uri, if (doc) { // Set viewBox if it doesn't exist - if (!doc->getRoot()->viewBox_set) { + if (!doc->getRoot()->viewBox_set + && (doc->getRoot()->width.unit != SVGLength::PERCENT) + && (doc->getRoot()->height.unit != SVGLength::PERCENT)) { DocumentUndo::setUndoSensitive(doc, false); doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDisplayUnit()), doc->getHeight().value(doc->getDisplayUnit()))); DocumentUndo::setUndoSensitive(doc, true); -- cgit v1.2.3