summaryrefslogtreecommitdiffstats
path: root/src/object/sp-item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object/sp-item.cpp')
-rw-r--r--src/object/sp-item.cpp17
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++