
# 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.
805 B
805 B
title | pull_requests | |
---|---|---|
Fixed UI draw order and `stack_z_offsets` changes |
|
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):
-
Box shadows
-
Node background colors
-
Node borders
-
Gradients
-
Border Gradients
-
Images (including texture-sliced images)
-
Materials
-
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 toBACKGROUND_COLOR
-
TEXTURE_SLICE
is removed, useIMAGE
. -
New
BORDER
,BORDER_GRADIENT
andTEXT
constants.