set z order after reorder

This commit is contained in:
minggo 2013-11-14 14:08:50 +08:00
parent a2bfc31ea0
commit a057274115
1 changed files with 3 additions and 1 deletions

View File

@ -237,11 +237,13 @@ void Node::_setZOrder(int z)
void Node::setZOrder(int z) void Node::setZOrder(int z)
{ {
_setZOrder(z);
if (_parent) if (_parent)
{ {
_parent->reorderChild(this, z); _parent->reorderChild(this, z);
} }
// should set "_ZOrder" after reorderChild, because the implementation of reorderChild subclass of Node, such as Sprite,
// will return when _ZOrder value is not changed
_setZOrder(z);
_eventDispatcher->setDirtyForNode(this); _eventDispatcher->setDirtyForNode(this);
} }