summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc8cc05)
raw | patch | inline | side by side (parent: fc8cc05)
author | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 11 May 2009 17:35:19 +0000 (17:35 +0000) | ||
committer | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 11 May 2009 17:35:19 +0000 (17:35 +0000) |
src/sp-item.cpp | patch | blob | history | |
src/ui/clipboard.cpp | patch | blob | history |
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index ff3952c25995c766a82ce004f4dad4197811afa2..662dc1cac7370d3007ac135aace282407e0905d5 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
*/
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];
}
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);
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index f569324873396e5530c3fe1164f1ae5e6c36ba36..2ee62cfec39df94c6df303362da11d8d41ada54e 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
// invers apply parent transform
Geom::Matrix doc2parent = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ sp_selection_apply_affine(selection, doc2parent);
// Update (among other things) all curves in paths, for bounds() to work
sp_document_ensure_up_to_date(target_document);
- // Don't exactly know what sp_document_ensure_up_to_date() does, but apparently it must be called before
- // item->getCenter() is used in sp_selection_apply_affine(). If not, then the center will be at (0,0)
- sp_selection_apply_affine(selection, doc2parent);
-
// move selection either to original position (in_place) or to mouse pointer
Geom::OptRect sel_bbox = selection->bounds();
if (sel_bbox) {