From 51d5d061f1756df3d3865c0d36522a7d8c5c9d22 Mon Sep 17 00:00:00 2001 From: speleo3 Date: Wed, 13 May 2009 17:41:26 +0000 Subject: [PATCH] parent transformation on import and paste (Bug #376064, Bug #375499) --- src/file.cpp | 6 ++++++ src/ui/clipboard.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/file.cpp b/src/file.cpp index f8d631455..80b424f5d 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1011,6 +1011,12 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, Inkscape::Selection *selection = sp_desktop_selection(desktop); selection->set(SP_ITEM(new_obj)); + // preserve parent and viewBox transformations + // c2p is identity matrix at this point unless sp_document_ensure_up_to_date is called + sp_document_ensure_up_to_date(doc); + Geom::Matrix affine = SP_ROOT(SP_DOCUMENT_ROOT(doc))->c2p * sp_item_i2doc_affine(SP_ITEM(place_to_insert)).inverse(); + sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false); + // To move the imported object, we must temporarily set the "transform pattern with // object" option. { diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 2ee62cfec..7e41006be 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -799,7 +799,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) // invers apply parent transform Geom::Matrix doc2parent = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse(); - sp_selection_apply_affine(selection, doc2parent); + sp_selection_apply_affine(selection, desktop->dt2doc() * doc2parent * desktop->doc2dt(), true, false); // Update (among other things) all curves in paths, for bounds() to work sp_document_ensure_up_to_date(target_document); -- 2.30.2