From 561b8791651a0b3f9d49dfd9809519f06039e0a4 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 28 Nov 2014 15:54:41 -0500 Subject: avoid recalculating viewbox if it is not necessary. (Bug 1384915, comment 24) Fixed bugs: - https://launchpad.net/bugs/1384915 (bzr r13776) --- src/document.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 25afc1311..c7d14727a 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -627,7 +627,7 @@ Inkscape::Util::Quantity SPDocument::getWidth() const return Inkscape::Util::Quantity(result, unit_table.getUnit(u)); } -void SPDocument::setWidth(const Inkscape::Util::Quantity &width) +void SPDocument::setWidth(const Inkscape::Util::Quantity &width, bool changeSize) { Inkscape::Util::Unit const *old_units = unit_table.getUnit("px"); if (root->width.unit) @@ -638,7 +638,7 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width) root->width.value = width.quantity; root->width.unit = (SVGLength::Unit) width.unit->svgUnit(); - if (root->viewBox_set) + if (root->viewBox_set && changeSize) root->viewBox.setMax(Geom::Point(root->viewBox.left() + (root->width.value / old_converted) * root->viewBox.width(), root->viewBox.bottom())); root->updateRepr(); @@ -662,7 +662,7 @@ Inkscape::Util::Quantity SPDocument::getHeight() const return Inkscape::Util::Quantity(result, unit_table.getUnit(u)); } -void SPDocument::setHeight(const Inkscape::Util::Quantity &height) +void SPDocument::setHeight(const Inkscape::Util::Quantity &height, bool changeSize) { Inkscape::Util::Unit const *old_units = unit_table.getUnit("px"); if (root->height.unit) @@ -673,7 +673,7 @@ void SPDocument::setHeight(const Inkscape::Util::Quantity &height) root->height.value = height.quantity; root->height.unit = (SVGLength::Unit) height.unit->svgUnit(); - if (root->viewBox_set) + if (root->viewBox_set && changeSize) root->viewBox.setMax(Geom::Point(root->viewBox.right(), root->viewBox.top() + (root->height.value / old_converted) * root->viewBox.height())); root->updateRepr(); -- cgit v1.2.3