diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-09-07 17:02:01 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-09-07 17:02:01 +0000 |
| commit | 0d0958e3b2aff0ed5f3ad7a98b4035213475c7f1 (patch) | |
| tree | 099d7926509e826b184def14a8e037e255fe36ab /src/sp-item.cpp | |
| parent | Fix gtk3 build (diff) | |
| download | inkscape-0d0958e3b2aff0ed5f3ad7a98b4035213475c7f1.tar.gz inkscape-0d0958e3b2aff0ed5f3ad7a98b4035213475c7f1.zip | |
Update to experimental r13543
(bzr r13090.1.108)
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 67a0eac13..c3cbe531f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -256,9 +256,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(); @@ -289,9 +293,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(); |
