diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2019-06-12 16:01:28 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2019-06-12 16:01:28 +0000 |
| commit | f724d2d99d2195dea3049bfe580b6b6f5386c7b6 (patch) | |
| tree | 7b7ae06ef2f6f16436790e5da14402ec34e1c552 /src/object/sp-item.cpp | |
| parent | Update comments to match reality. (diff) | |
| download | inkscape-f724d2d99d2195dea3049bfe580b6b6f5386c7b6.tar.gz inkscape-f724d2d99d2195dea3049bfe580b6b6f5386c7b6.zip | |
Refactor: convert rotate_rel() to a method.
Diffstat (limited to 'src/object/sp-item.cpp')
| -rw-r--r-- | src/object/sp-item.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 5a8e23e84..ee54c8ada 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -1716,6 +1716,23 @@ void SPItem::convert_to_guides() const { sp_guide_pt_pairs_to_guides(document, pts); } +void SPItem::rotate_rel(Geom::Rotate const &rotation) +{ + Geom::Point center = getCenter(); + Geom::Translate const s(getCenter()); + Geom::Affine affine = Geom::Affine(s).inverse() * Geom::Affine(rotation) * Geom::Affine(s); + + // Rotate item. + set_i2d_affine(i2dt_affine() * (Geom::Affine)affine); + // Use each item's own transform writer, consistent with sp_selection_apply_affine() + doWriteTransform(transform); + + // Restore the center position (it's changed because the bbox center changed) + if (isCenterSet()) { + setCenter(center * affine); + updateRepr(); + } +} /* Local Variables: mode:c++ |
