UI: allow border radius to be optional for images and background (#12592)

# Objective

- #12500 broke images and background colors in UI. Try examples
`overflow`, `ui_scaling` or `ui_texture_atlas`

## Solution

- Makes the component `BorderRadius` optional in the query, as it's not
always present. Use `[0.; 4]` as border radius in the extracted node
when none was found
This commit is contained in:
François Mockers 2024-03-20 14:11:24 +01:00 committed by GitHub
parent f38895a414
commit 779e4c4901
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -193,7 +193,7 @@ pub fn extract_uinode_background_colors(
Option<&CalculatedClip>,
Option<&TargetCamera>,
&BackgroundColor,
&BorderRadius,
Option<&BorderRadius>,
)>,
>,
) {
@ -224,8 +224,11 @@ pub fn extract_uinode_background_colors(
continue;
}
let border_radius =
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0);
let border_radius = if let Some(border_radius) = border_radius {
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0)
} else {
[0.; 4]
};
extracted_uinodes.uinodes.insert(
entity,
@ -268,7 +271,7 @@ pub fn extract_uinode_images(
&UiImage,
Option<&TextureAtlas>,
Option<&ComputedTextureSlices>,
&BorderRadius,
Option<&BorderRadius>,
)>,
>,
) {
@ -323,8 +326,11 @@ pub fn extract_uinode_images(
),
};
let border_radius =
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0);
let border_radius = if let Some(border_radius) = border_radius {
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0)
} else {
[0.; 4]
};
extracted_uinodes.uinodes.insert(
commands.spawn_empty().id(),