From a3c5d98bfa11fdfb6213a3f2132b1aee3bae1f2e Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 8 Sep 2017 16:23:01 +0800 Subject: [PATCH] reorderChild can update arrival order --- cocos2d/core/base-nodes/CCNode.js | 5 ++--- cocos2d/particle/CCParticleBatchNode.js | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cocos2d/core/base-nodes/CCNode.js b/cocos2d/core/base-nodes/CCNode.js index 62bd9e4a38..9d3e6f15e5 100644 --- a/cocos2d/core/base-nodes/CCNode.js +++ b/cocos2d/core/base-nodes/CCNode.js @@ -306,6 +306,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ * @param {Number} localZOrder */ setLocalZOrder: function (localZOrder) { + if (localZOrder === this._localZOrder) + return; if (this._parent) this._parent.reorderChild(this, localZOrder); else @@ -1365,9 +1367,6 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ cc.log(cc._LogInfos.Node_reorderChild_2); return; } - if (zOrder === child.zIndex) { - return; - } cc.renderer.childrenOrderDirty = this._reorderChildDirty = true; child.arrivalOrder = cc.s_globalOrderOfArrival; cc.s_globalOrderOfArrival++; diff --git a/cocos2d/particle/CCParticleBatchNode.js b/cocos2d/particle/CCParticleBatchNode.js index 3952bcdbbb..53c381fc30 100644 --- a/cocos2d/particle/CCParticleBatchNode.js +++ b/cocos2d/particle/CCParticleBatchNode.js @@ -278,9 +278,6 @@ cc.ParticleBatchNode = cc.Node.extend(/** @lends cc.ParticleBatchNode# */{ return; } - if (zOrder === child.zIndex) - return; - // no reordering if only 1 child if (this._children.length > 1) { var getIndexes = this._getCurrentIndex(child, zOrder);