summaryrefslogtreecommitdiffstats
path: root/src/sp-item.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/sp-item.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/sp-item.cpp')
-rw-r--r--src/sp-item.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index c79508199..63fc833b3 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -234,9 +234,13 @@ void SPItem::setCenter(Geom::Point const &object_centre) {
document->ensureUpToDate();
// Copied from DocumentProperties::onDocUnitChange()
- gdouble viewscale_w = this->document->getWidth().value("px") / this->document->getRoot()->viewBox.width();
- gdouble viewscale_h = this->document->getHeight().value("px")/ this->document->getRoot()->viewBox.height();
- gdouble viewscale = std::min(viewscale_h, viewscale_w);
+ gdouble viewscale = 1.0;
+ Geom::Rect vb = this->document->getRoot()->viewBox;
+ if ( !vb.hasZeroArea() ) {
+ gdouble viewscale_w = this->document->getWidth().value("px") / vb.width();
+ gdouble viewscale_h = this->document->getHeight().value("px")/ vb.height();
+ viewscale = std::min(viewscale_h, viewscale_w);
+ }
// FIXME this is seriously wrong
Geom::OptRect bbox = desktopGeometricBounds();
@@ -267,9 +271,13 @@ Geom::Point SPItem::getCenter() const {
document->ensureUpToDate();
// Copied from DocumentProperties::onDocUnitChange()
- gdouble viewscale_w = this->document->getWidth().value("px") / this->document->getRoot()->viewBox.width();
- gdouble viewscale_h = this->document->getHeight().value("px")/ this->document->getRoot()->viewBox.height();
- gdouble viewscale = std::min(viewscale_h, viewscale_w);
+ gdouble viewscale = 1.0;
+ Geom::Rect vb = this->document->getRoot()->viewBox;
+ if ( !vb.hasZeroArea() ) {
+ gdouble viewscale_w = this->document->getWidth().value("px") / vb.width();
+ gdouble viewscale_h = this->document->getHeight().value("px")/ vb.height();
+ viewscale = std::min(viewscale_h, viewscale_w);
+ }
// FIXME this is seriously wrong
Geom::OptRect bbox = desktopGeometricBounds();