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
Z-index #27
Comments
Check out Container.addChildAt(): http://easeljs.com/docs/symbols/Container.html#addChildAt (Stage extends Container). Does this do what you are looking for? Also, if you re-add an existing child to the stage, it will move it to the top of the z-index. i.e.
|
Yes, but this is not anywhere as simple as Not only CSS and html and javascript can set zindex, but so does flex. |
Maybe I am missing something, but the Flex example looked similar to the EaselJS API:
Could you suggest the API you think would work better, and we could consider that. |
The last example goes like this:
So, taking out the horrible xml verbose noise, it can be simpler. |
Having worked extensively with both relative and absolute depths, I would much prefer to stick with relative depths. They have less overhead, and are (in general) easier to work with. That said, we do provide sortChildren, which would make it fairly straightforward to implement a z-index system if you'd like one. The changeZIndex example above is functionally identical to addChildAt, with a range check added. This is what it would look like in EaselJS:
|
Yes, but if I have 5 types of N elements, on the screen, each having a different z-index, adding another element will take O(N), O(NlgN) if sorting is needed (well, can be back to O(N) using linear time sorting algorithms). Using a better data-structure, such as a Hash the takes a z-index and points to a list of elements, changing the z-index of any element and adding/removing any element would take only O(1). But ignoring performance, it keeps the user design simpler. For instance, you can do all easeljs does in pure canvas. It is just not simple. Or convenient. |
I know this is rather old but this issue is a real showstopper for more complex scenes. Is it possible that everyone is coding platformers where the Zindex is only marginally important? EDIT:
|
while conceptually different than what CSS devs are used to, relative depths is more flexible, vastly more efficient (for the reasons stated by enriko), and easier to extend & maintain. |
There is no way to control z-index now (beside removing and adding everything in the right order). It would be nice to have control over the z-index conceptual property in a concrete and easy way.
The text was updated successfully, but these errors were encountered: