mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Extract borders without border radius (#15020)
# Objective The `BorderRadius` component shouldn't be required to draw borders for nodes with sharp corners. ## Solution Make `BorderRadius` optional in `extract_uinode_borders`'s UI node query.
This commit is contained in:
parent
61f9f8c5f6
commit
96942058f7
1 changed files with 13 additions and 10 deletions
|
@ -508,7 +508,7 @@ pub fn extract_uinode_borders(
|
||||||
Option<&Parent>,
|
Option<&Parent>,
|
||||||
&Style,
|
&Style,
|
||||||
&BorderColor,
|
&BorderColor,
|
||||||
&BorderRadius,
|
Option<&BorderRadius>,
|
||||||
),
|
),
|
||||||
Without<ContentSize>,
|
Without<ContentSize>,
|
||||||
>,
|
>,
|
||||||
|
@ -526,7 +526,7 @@ pub fn extract_uinode_borders(
|
||||||
parent,
|
parent,
|
||||||
style,
|
style,
|
||||||
border_color,
|
border_color,
|
||||||
border_radius,
|
maybe_border_radius,
|
||||||
) in &uinode_query
|
) in &uinode_query
|
||||||
{
|
{
|
||||||
let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get())
|
let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get())
|
||||||
|
@ -574,14 +574,17 @@ pub fn extract_uinode_borders(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let border_radius = resolve_border_radius(
|
let border_radius = if let Some(border_radius) = maybe_border_radius {
|
||||||
border_radius,
|
let resolved_radius = resolve_border_radius(
|
||||||
node.size(),
|
border_radius,
|
||||||
ui_logical_viewport_size,
|
node.size(),
|
||||||
ui_scale.0,
|
ui_logical_viewport_size,
|
||||||
);
|
ui_scale.0,
|
||||||
|
);
|
||||||
let border_radius = clamp_radius(border_radius, node.size(), border.into());
|
clamp_radius(resolved_radius, node.size(), border.into())
|
||||||
|
} else {
|
||||||
|
[0.; 4]
|
||||||
|
};
|
||||||
let transform = global_transform.compute_matrix();
|
let transform = global_transform.compute_matrix();
|
||||||
|
|
||||||
extracted_uinodes.uinodes.insert(
|
extracted_uinodes.uinodes.insert(
|
||||||
|
|
Loading…
Reference in a new issue