summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorThomas Holder <speleo3@users.sourceforge.net>2009-05-11 17:35:19 +0000
committerspeleo3 <speleo3@users.sourceforge.net>2009-05-11 17:35:19 +0000
commitb73014debefe2255afac9093bc9e6a7cdfe2f649 (patch)
tree7e92f75a8dd11178c97417b6f3800050e98a7b30 /src/sp-item.cpp
parentRenaming Alpha engraving to Alpha draw and Alpha engraving, color to Alpha fi... (diff)
downloadinkscape-b73014debefe2255afac9093bc9e6a7cdfe2f649.tar.gz
inkscape-b73014debefe2255afac9093bc9e6a7cdfe2f649.zip
call sp_document_ensure_up_to_date for getCenter/setCenter (Bug #374968)
(bzr r7860)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index ff3952c25..662dc1cac 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -293,6 +293,9 @@ SPItem::setExplicitlyHidden(bool const val) {
*/
void
SPItem::setCenter(Geom::Point object_centre) {
+ // for getBounds() to work
+ sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+
Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this));
if (bbox) {
transform_center_x = object_centre[Geom::X] - bbox->midpoint()[Geom::X];
@@ -315,6 +318,9 @@ bool SPItem::isCenterSet() {
}
Geom::Point SPItem::getCenter() const {
+ // for getBounds() to work
+ sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this));
+
Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this));
if (bbox) {
return to_2geom(bbox->midpoint()) + Geom::Point (this->transform_center_x, this->transform_center_y);