13
0

make raise_to_top() and lower_to_bottom() no-ops if item is already in the right place

This commit is contained in:
Paul Davis 2014-01-02 16:49:42 -05:00
parent 7f83975e7d
commit 7b24be86a2

View File

@ -233,6 +233,12 @@ Group::clear (bool with_delete)
void
Group::raise_child_to_top (Item* i)
{
if (!_items.empty()) {
if (_items.front() == i) {
return;
}
}
_items.remove (i);
_items.push_back (i);
invalidate_lut ();
@ -259,6 +265,11 @@ Group::raise_child (Item* i, int levels)
void
Group::lower_child_to_bottom (Item* i)
{
if (!_items.empty()) {
if (_items.back() == i) {
return;
}
}
_items.remove (i);
_items.push_front (i);
invalidate_lut ();