Code

bug #168777 (consider root transform and viewBox)
authorspeleo3 <speleo3@users.sourceforge.net>
Sat, 29 Nov 2008 13:04:08 +0000 (13:04 +0000)
committerspeleo3 <speleo3@users.sourceforge.net>
Sat, 29 Nov 2008 13:04:08 +0000 (13:04 +0000)
src/text-context.cpp

index 1dd5e4e82f0ec1c13d0434fa4ca1ee6eab822b4c..078d2bece62dd30e555705e5b6eb020a274464ad 100644 (file)
@@ -512,6 +512,17 @@ sp_text_context_setup_text(SPTextContext *tc)
     sp_desktop_selection(ec->desktop)->set(text_item);
     Inkscape::GC::release(rtext);
     text_item->transform = SP_ITEM(ec->desktop->currentRoot())->getRelativeTransform(ec->desktop->currentLayer());
+
+    // bug #168777 (consider root transform and viewBox)
+    // TODO: more generic solution desirable
+    Geom::Matrix root_transform = sp_item_i2doc_affine(SP_ITEM(ec->desktop->currentRoot()));
+    if (!root_transform.isIdentity()) {
+        text_item->transform = root_transform.inverse() * text_item->transform;
+        Geom::Point pdoc = tc->pdoc * root_transform;
+        sp_repr_set_svg_double(rtext, "x", pdoc[Geom::X]);
+        sp_repr_set_svg_double(rtext, "y", pdoc[Geom::Y]);
+    }
+
     text_item->updateRepr();
     sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
                      _("Create text"));