diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-09-03 05:12:58 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-09-03 05:12:58 +0000 |
| commit | 3c85037c43ca281383a8cb46e7bb3cbe79a5b159 (patch) | |
| tree | f94eef383b6af32c3f97d1d904a3e9f64525c0c0 /src/selection-chemistry.cpp | |
| parent | Undo inadvertent commit (diff) | |
| download | inkscape-3c85037c43ca281383a8cb46e7bb3cbe79a5b159.tar.gz inkscape-3c85037c43ca281383a8cb46e7bb3cbe79a5b159.zip | |
fix pattern transform when doing object-to-pattern within a transformed group
(bzr r1666)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 3d8b5c5aa..94e0b709a 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2139,6 +2139,8 @@ sp_selection_tile(bool apply) // bottommost object, after sorting SPObject *parent = SP_OBJECT_PARENT (items->data); + NR::Matrix parent_transform = sp_item_i2root_affine(SP_ITEM(parent)); + // remember the position of the first item gint pos = SP_OBJECT_REPR (items->data)->position(); @@ -2166,7 +2168,7 @@ sp_selection_tile(bool apply) prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); const gchar *pat_id = pattern_tile (repr_copies, bounds, document, - NR::Matrix(NR::translate(desktop->dt2doc(NR::Point(r.min()[NR::X], r.max()[NR::Y])))), move); + NR::Matrix(NR::translate(desktop->dt2doc(NR::Point(r.min()[NR::X], r.max()[NR::Y])))) * parent_transform.inverse(), parent_transform * move); // restore compensation setting prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation); @@ -2174,10 +2176,14 @@ sp_selection_tile(bool apply) if (apply) { Inkscape::XML::Node *rect = sp_repr_new ("svg:rect"); rect->setAttribute("style", g_strdup_printf("stroke:none;fill:url(#%s)", pat_id)); - sp_repr_set_svg_double(rect, "width", bounds.extent(NR::X)); - sp_repr_set_svg_double(rect, "height", bounds.extent(NR::Y)); - sp_repr_set_svg_double(rect, "x", bounds.min()[NR::X]); - sp_repr_set_svg_double(rect, "y", bounds.min()[NR::Y]); + + NR::Point min = bounds.min() * parent_transform.inverse(); + NR::Point max = bounds.max() * parent_transform.inverse(); + + sp_repr_set_svg_double(rect, "width", max[NR::X] - min[NR::X]); + sp_repr_set_svg_double(rect, "height", max[NR::Y] - min[NR::Y]); + sp_repr_set_svg_double(rect, "x", min[NR::X]); + sp_repr_set_svg_double(rect, "y", min[NR::Y]); // restore parent and position SP_OBJECT_REPR (parent)->appendChild(rect); |
