From dc80e5d0bf82f005628881134b929aa4838308d5 Mon Sep 17 00:00:00 2001 From: chr Date: Tue, 23 May 2017 21:48:22 +0200 Subject: selection chemistry: implement z-stack order Bug #1395452 "raise and lower objects" used to stack objects above/below the next overlapping object, which makes it impossible to change the z-order of objects that don't overlap. Fixes also the object manager panel Conflicts: src/selection-chemistry.cpp src/selection-chemistry.h src/sp-item.cpp (bzr r15698.1.7) --- src/sp-item.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index e2f678957..368f8896c 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -306,15 +306,17 @@ void SPItem::raiseToTop() { } } -void SPItem::raiseOne() { +bool SPItem::raiseOne() { auto next_higher = std::find_if(++parent->children.iterator_to(*this), parent->children.end(), &is_item); if (next_higher != parent->children.end()) { Inkscape::XML::Node *ref = next_higher->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); + return true; } + return false; } -void SPItem::lowerOne() { +bool SPItem::lowerOne() { using Inkscape::Algorithms::find_last_if; auto next_lower = find_last_if(parent->children.begin(), parent->children.iterator_to(*this), &is_item); @@ -325,7 +327,9 @@ void SPItem::lowerOne() { ref = next_lower->getRepr(); } getRepr()->parent()->changeOrder(getRepr(), ref); + return true; } + return false; } void SPItem::lowerToBottom() { -- cgit v1.2.3