summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-02-28 19:29:37 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-02-28 19:29:37 +0000
commit74f4fdc917b43d0cc5edb652eb7f2a4c757f9411 (patch)
treef773e84c7f9fb8f80c5a6fd6b66aca234e5af6d2 /src
parentdoxygen: include ifdef'd code (diff)
downloadinkscape-74f4fdc917b43d0cc5edb652eb7f2a4c757f9411.tar.gz
inkscape-74f4fdc917b43d0cc5edb652eb7f2a4c757f9411.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/align-and-distribute.cpp13
1 files changed, 11 insertions, 2 deletions
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<SPItem*>::iterator it(selected.begin());
it != selected.end(); ++it)
{