Skip to content

Commit fa7270a

Browse files
fixed "SpriteBatchNodeReorderSameIndex" test case
1 parent 7d926a4 commit fa7270a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cocos2d/sprite_nodes/CCSpriteBatchNode.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,7 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
822822
j = i - 1;
823823

824824
//continue moving element downwards while zOrder is smaller or when zOrder is the same but orderOfArrival is smaller
825-
while (j >= 0 && (tempItem.getZOrder() < this._children[j].getZOrder() ||
826-
(tempItem.getZOrder() == this._children[j].getZOrder() && tempItem.getOrderOfArrival() < this._children[j].getOrderOfArrival()))) {
825+
while (j >= 0 && (tempItem.getZOrder() < this._children[j].getZOrder() || (tempItem.getZOrder() == this._children[j].getZOrder() && tempItem.getOrderOfArrival() < this._children[j].getOrderOfArrival()))) {
827826
this._children[j + 1] = this._children[j];
828827
j--;
829828
}
@@ -838,11 +837,11 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
838837
var index = 0;
839838
//fast dispatch, give every child a new atlasIndex based on their relative zOrder (keep parent -> child relations intact)
840839
// and at the same time reorder descedants and the quads to the right index
841-
if (cc.renderContextType == cc.WEBGL) {
840+
//if (cc.renderContextType == cc.WEBGL) {
842841
for (i = 0; i < this._children.length; i++) {
843842
index = this._updateAtlasIndex(this._children[i], index);
844843
}
845-
}
844+
//}
846845
}
847846

848847
this._reorderChildDirty = false;

0 commit comments

Comments
 (0)