summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-09-02 12:17:40 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-09-02 12:17:40 +0000
commit78ff0bee3e358adf1051d4037c4043cc223d5afe (patch)
treea23ed22cc7a5272585141a60afce42e2654458e1 /src/sp-item.cpp
parentupdate to trunk (r13532) (diff)
parentconfigure.ac: Quell warnings about AM_PROG_AR when using automake 1.12 (diff)
downloadinkscape-78ff0bee3e358adf1051d4037c4043cc223d5afe.tar.gz
inkscape-78ff0bee3e358adf1051d4037c4043cc223d5afe.zip
update to trunk (r13540)
(bzr r13398.1.9)
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 428f9555e..19dc71785 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();