Skip to content

Commit 779e4c4

Browse files
authored
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
1 parent f38895a commit 779e4c4

File tree

1 file changed

+12
-6
lines changed
  • crates/bevy_ui/src/render

1 file changed

+12
-6
lines changed

crates/bevy_ui/src/render/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub fn extract_uinode_background_colors(
193193
Option<&CalculatedClip>,
194194
Option<&TargetCamera>,
195195
&BackgroundColor,
196-
&BorderRadius,
196+
Option<&BorderRadius>,
197197
)>,
198198
>,
199199
) {
@@ -224,8 +224,11 @@ pub fn extract_uinode_background_colors(
224224
continue;
225225
}
226226

227-
let border_radius =
228-
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0);
227+
let border_radius = if let Some(border_radius) = border_radius {
228+
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0)
229+
} else {
230+
[0.; 4]
231+
};
229232

230233
extracted_uinodes.uinodes.insert(
231234
entity,
@@ -268,7 +271,7 @@ pub fn extract_uinode_images(
268271
&UiImage,
269272
Option<&TextureAtlas>,
270273
Option<&ComputedTextureSlices>,
271-
&BorderRadius,
274+
Option<&BorderRadius>,
272275
)>,
273276
>,
274277
) {
@@ -323,8 +326,11 @@ pub fn extract_uinode_images(
323326
),
324327
};
325328

326-
let border_radius =
327-
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0);
329+
let border_radius = if let Some(border_radius) = border_radius {
330+
resolve_border_radius(border_radius, uinode.size(), viewport_size, ui_scale.0)
331+
} else {
332+
[0.; 4]
333+
};
328334

329335
extracted_uinodes.uinodes.insert(
330336
commands.spawn_empty().id(),

0 commit comments

Comments
 (0)