Open wouterlucas opened 3 months ago
My opinion is that z-index should not reorder children, because currently it prevents a framework to control the nodes ordering (and BTW node children order should be directly controllable by the framework).
I believe the ordering should done at the rendering phase: when the quads are collected, they can be bucketed by z-index, then rendered in order.
Likewise, when you'll look at resolving elements at (x,y) it can return results ordered by z-index.
We actually had z-ordering at addQuads
before, but that would mean it would run it every time even when nothing changed on the ordering which was had a pretty big impact on performance. Which is why we changed it to be done ahead of time and using the update graph.
Bucketing by z-index is pretty intrusive, might as well look into depth buffer usage at that point. Though would need some metrics on how well that is supported across devices.
For now have the ability to skip sorting and providing presorted list on the API would be a good middle ground.
Currently a zIndex is required and every parent/child has its own zIndex context. This has an impact on performance because a) sorting is always performed and b) this triggers a lot of parent/child updates that bubble creating more re-sorts.
With L2 not providing a zIndex would not created a sorted zIndex context, similar to CSS. Alternatively you could set
forceZIndexContext
to true to force it.Suggestion is to:
Alternatively we can also strip out the zIndexing all together and have the app framework take care of providing children in the correct order. However this would be a big behavioral change over todays implementation, however it would severely reduce the amount of sorting/bubbling the renderer needs to do every time.
Feedback please: @erikhaandrikman @elsassph @michielvandergeest