1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Fix moveToBack/moveToFront when used on objects that have a parent

This commit is contained in:
fgenesis 2015-11-28 23:42:39 +01:00
parent ed089f38f7
commit d8da8576e8

View file

@ -507,10 +507,10 @@ void RenderObject::moveToFront()
{ {
if(RenderObject *p = parent) if(RenderObject *p = parent)
{ {
if(p->children.size() && p->children[0] != this) if(p->children.size() && p->children[p->children.size()-1] != this)
{ {
p->removeChild(this); p->removeChild(this);
p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_FRONT); p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_BACK); // To back of list -> rendered on top
} }
} }
else if (layer != -1) else if (layer != -1)
@ -521,10 +521,10 @@ void RenderObject::moveToBack()
{ {
if(RenderObject *p = parent) if(RenderObject *p = parent)
{ {
if(p->children.size() && p->children[p->children.size()-1] != this) if(p->children.size() && p->children[0] != this)
{ {
p->removeChild(this); p->removeChild(this);
p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_BACK); p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_FRONT); // To front of list -> rendered first, below everything else
} }
} }
else if (layer != -1) else if (layer != -1)