
# Objective During the migration to required components a lot of things were changed around and somehow the draw order for some UI elements ended up depending on the system ordering in `RenderSystems::Queue`, which can sometimes result in the elements being drawn in the wrong order. Fixes #19674 ## Solution * Added some more `stack_z_offsets` constants and used them to enforce an explicit ordering. * Removed the `stack_index: u32` field from `ExtractedUiNodes` and replaced it with a `z_order: f32` field. These changes should fix all the ordering problems. ## Testing I added a nine-patched bordered node with a navy background color to the slice section of the `testbed_ui` example. The border should always be drawn above the background color.
35 lines
805 B
Markdown
35 lines
805 B
Markdown
---
|
|
title: Fixed UI draw order and `stack_z_offsets` changes
|
|
pull_requests: [19691]
|
|
---
|
|
|
|
The draw order of some renderable UI elements relative to others wasn't fixed and depended on system ordering.
|
|
In particular the ordering of background colors and texture sliced images was sometimes swapped.
|
|
|
|
The UI draw order is now fixed.
|
|
The new order is (back-to-front):
|
|
|
|
1. Box shadows
|
|
|
|
2. Node background colors
|
|
|
|
3. Node borders
|
|
|
|
4. Gradients
|
|
|
|
5. Border Gradients
|
|
|
|
6. Images (including texture-sliced images)
|
|
|
|
7. Materials
|
|
|
|
8. Text (including text shadows)
|
|
|
|
The values of the `stack_z_offsets` constants have been updated to enforce the new ordering. Other changes:
|
|
|
|
* `NODE` is renamed to `BACKGROUND_COLOR`
|
|
|
|
* `TEXTURE_SLICE` is removed, use `IMAGE`.
|
|
|
|
* New `BORDER`, `BORDER_GRADIENT` and `TEXT` constants.
|