Skip to content

Commit a3c5d98

Browse files
committed
reorderChild can update arrival order
1 parent b2b9b6e commit a3c5d98

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

cocos2d/core/base-nodes/CCNode.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
306306
* @param {Number} localZOrder
307307
*/
308308
setLocalZOrder: function (localZOrder) {
309+
if (localZOrder === this._localZOrder)
310+
return;
309311
if (this._parent)
310312
this._parent.reorderChild(this, localZOrder);
311313
else
@@ -1365,9 +1367,6 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
13651367
cc.log(cc._LogInfos.Node_reorderChild_2);
13661368
return;
13671369
}
1368-
if (zOrder === child.zIndex) {
1369-
return;
1370-
}
13711370
cc.renderer.childrenOrderDirty = this._reorderChildDirty = true;
13721371
child.arrivalOrder = cc.s_globalOrderOfArrival;
13731372
cc.s_globalOrderOfArrival++;

cocos2d/particle/CCParticleBatchNode.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ cc.ParticleBatchNode = cc.Node.extend(/** @lends cc.ParticleBatchNode# */{
278278
return;
279279
}
280280

281-
if (zOrder === child.zIndex)
282-
return;
283-
284281
// no reordering if only 1 child
285282
if (this._children.length > 1) {
286283
var getIndexes = this._getCurrentIndex(child, zOrder);

0 commit comments

Comments
 (0)