From 74f4fdc917b43d0cc5edb652eb7f2a4c757f9411 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 28 Feb 2018 20:29:37 +0100 Subject: Allow to align multiple objects as group relatively to a single object This makes "treat selection as group" useful with the selections "Last selected / First selected / Biggest object / Smallest object" in which case all elements will be moved as a group relative to the "focused" element which will be kept fixed. --- src/ui/dialog/align-and-distribute.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index d622b5e06..045b4a98e 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -169,11 +169,20 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) Geom::Point mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); - bool changed = false; if (sel_as_group) - b = selection->preferredBounds(); + if (focus) { + // use bounding box of all selected elements except the "focused" element + Inkscape::ObjectSet copy; + copy.add(selection->objects().begin(), selection->objects().end()); + copy.remove(focus); + b = copy.preferredBounds(); + } else { + // use bounding box of all selected elements + b = selection->preferredBounds(); + } //Move each item in the selected list separately + bool changed = false; for (std::vector::iterator it(selected.begin()); it != selected.end(); ++it) { -- cgit v1.2.3