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

make ListView::setGlobalZOrder() work #17098

Merged
merged 4 commits into from
Jan 4, 2017
Merged

Conversation

minggo
Copy link
Contributor

@minggo minggo commented Jan 3, 2017

No description provided.

@minggo
Copy link
Contributor Author

minggo commented Jan 3, 2017

@zilongshanren please help to review it, thanks.

if (_buttonDisabledRenderer)
_buttonDisabledRenderer->setGlobalZOrder(globalZOrder);
if (_titleRenderer)
_titleRenderer->setGlobalZOrder(globalZOrder);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh it is not needed since ProtectedNode::setGlobalZOder() will change the protected children's global z order.

@zilongshanren
Copy link
Member

@minggo
It looks good to me, but I suggest to add another three tests for ui::Layout, ui::ScrollView and ui::PageView.

@minggo minggo merged commit 79126ea into cocos2d:v3 Jan 4, 2017
@minggo minggo deleted the listview-globalzorder branch January 6, 2017 03:44
stevetranby added a commit to stevetranby/cocos2d-x that referenced this pull request Jan 14, 2017
…futurePRs

* commit '2dc382bdf0b40892bec06f1fa5b3cdde418b6798':
  English refinements (cocos2d#17109)
  Slice9 Sprite with triangles, not quads (cocos2d#17105)
  Openssl adjust (cocos2d#17106)
  fix type conversion warnings  (cocos2d#17061)
  fix text input auto correction type (cocos2d#17085)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#17103)
  make ListView::setGlobalZOrder() work (cocos2d#17098)
  update chinese release note
  implements issue cocos2d#17069 (cocos2d#17090)
  Fix web engine canvas mode issues (cocos2d#17095)

submodules updated:
- web
- bindings-generator
@tiagomartines11
Copy link
Contributor

tiagomartines11 commented Jul 11, 2017

I believe ui::Widget needs similar treatment to propagate globalZOrder properly.

Example, assuming a tree like this:
ScrollView (z:0) -> Layout (z:0) -> TextBMFont (z:0) -> TextBMFont (z:0)

Before this fix:
scrollView->setGlobalZOrder(200) would make:
ScrollView (z:200) -> Layout (z:0) -> TextBMFont (z:0) -> TextBMFont (z:0)

After this fix:
scrollView->setGlobalZOrder(200) makes:
ScrollView (z:200) -> Layout (z:200) -> TextBMFont (z:200) -> TextBMFont (z:0)

This is highly confusing and prevents properly ordering UI elements (both for clipping and for ordering commands).

Can you please review this?

@tankorsmash
Copy link
Contributor

Yeah, this change means that if you add a child to a Layout, and want to have a custom global z order for it, you must wait until after you add the child to the Layout.

Not sure what the best approach is though, but it seems like there's a few different concerns that are conflicting with each other.

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.

4 participants