Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the performance of zIndex when there are a large number of nodes. #5899

Merged
merged 1 commit into from Dec 14, 2019

Conversation

caryliu1999
Copy link
Contributor

@caryliu1999 caryliu1999 commented Dec 13, 2019

zIndex优化的PR重新提交:#5701

var i = 0, len = siblings.length, sibling;
for (; i < len; i++) {
sibling = siblings[i];
sibling._updateOrderOfArrival();
Copy link
Member

@jareguo jareguo Dec 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIBLING_ORDER_CHANGED 的变化,在 2.3 版本更新说明里明确一下吧

@holycanvas holycanvas merged commit 78082b5 into cocos:v2.3.0 Dec 14, 2019
1 check passed
@bttscut
Copy link

@bttscut bttscut commented Feb 22, 2020

2.2.1 我每次update会重设一次场景中所有对象的zindex,达到相应的遮挡效果,升级2.3之后,在屏幕上不断移动场景时(场景物体移出和移入屏幕),遮挡关系会出错误,我暂无时间排查,不知道你们可否帮忙快速定位下问题?之前是用setSiblingIndex,性能损失更大,2.3改回用setSiblingIndex,逻辑就是正确的

    target.zIndex = CSprite.draw_index;
    // target.setSiblingIndex(-1);
    CSprite.draw_index++;

@jareguo
Copy link
Member

@jareguo jareguo commented Feb 26, 2020

抱歉,在其它开发者的帮助下,已经查出可能的原因了。
修复方法: #6227

@caryliu1999 caryliu1999 deleted the v2.3.0-zindex branch Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants