From ae65480e4089a909a979962fce9265ab44d05b47 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Thu, 7 Oct 2010 22:38:37 +0200 Subject: Fix self-snapping when dragging the transformation center of a selection containing multiple items (as reported by LucaDC in LP #607107, comment #30) (bzr r9817) --- src/seltrans.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 7dbeb4173..9a1fdf4ad 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1338,18 +1338,15 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state) // Move the item's transformation center gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state) { - // Center is being dragged for the first item in the selection only - // Find out which item is first ... - GSList *items = (GSList *) const_cast(_selection)->itemList(); - SPItem *first = NULL; - if (items) { - first = reinterpret_cast(g_slist_last(items)->data); // from the first item in selection - } - // ... and store that item because later on we need to make sure that - // this transformation center won't snap to itself SnapManager &m = _desktop->namedview->snap_manager; m.setup(_desktop); - m.setRotationCenterSource(first); + + // When dragging the transformation center while multiple items have been selected, then those + // items will share a single center. While dragging that single center, it should never snap to the + // centers of any of the selected objects. Therefore we will have to pass the list of selected items + // to the snapper, to avoid self-snapping of the rotation center + GSList *items = (GSList *) const_cast(_selection)->itemList(); + m.setRotationCenterSource(items); m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); m.unSetup(); -- cgit v1.2.3