summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8b2786c)
raw | patch | inline | side by side (parent: 8b2786c)
author | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 8 Dec 2008 22:22:51 +0000 (22:22 +0000) | ||
committer | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 8 Dec 2008 22:22:51 +0000 (22:22 +0000) |
src/ui/clipboard.cpp | patch | blob | history |
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index bd3edadda28ab8487585e0c042015b0794d44a87..af568659c4234190022a8743e7b18908f3b4c8f7 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
// Get two bounding box corners of the data in the clipboard (still in it's original position)
sp_repr_get_point(clipnode, "min", &min); //In desktop coordinates
sp_repr_get_point(clipnode, "max", &max);
+#if 0
// Calculate the upper-left page corner in desktop coordinates (where the pasted objects are located)
Geom::Point ul_page_corner = desktop->doc2dt(Geom::Point(0,0));
// Calculate the upper-left bbox corner of the original objects
// Now calculate how far we would have to move the pasted objects to get them
// at the location of the original
rel_pos_original = ul_sel_corner - ul_page_corner; // in desktop coordinates
+#endif
+ rel_pos_original = Geom::Point(min[Geom::X], max[Geom::Y]);
}
// Calculate the relative location of the mouse pointer
selection->setReprList(pasted_objects); // Change the selection to the freshly pasted objects
sp_document_ensure_up_to_date(target_document); // Update (among other things) all curves in paths, for bounds() to work
+ // TODO: Text does not get transformed!?
+ Geom::Matrix doc2parent = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+ sp_selection_apply_affine(selection, doc2parent);
+
Geom::OptRect sel_bbox = selection->bounds(); //In desktop coordinates
// PS: We could also have used the min/max corners calculated above, instead of selection->bounds() because
// we know that after pasting the upper left corner of the selection will be aligend to the corresponding
// Now calculate how far we would have to move the pasted objects to get their
// midpoint at the location of the mouse pointer
rel_pos_mouse = pos_mouse - to_2geom(sel_bbox->midpoint());
+ rel_pos_original -= sel_bbox->corner(3);
+ } else {
+ rel_pos_original -= desktop->doc2dt(Geom::Point(0,0));
}
// Determine which offset we need to apply to the pasted objects