mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 22:20:20 +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>,
|
||||
&Style,
|
||||
&BorderColor,
|
||||
&BorderRadius,
|
||||
Option<&BorderRadius>,
|
||||
),
|
||||
Without<ContentSize>,
|
||||
>,
|
||||
|
@ -526,7 +526,7 @@ pub fn extract_uinode_borders(
|
|||
parent,
|
||||
style,
|
||||
border_color,
|
||||
border_radius,
|
||||
maybe_border_radius,
|
||||
) in &uinode_query
|
||||
{
|
||||
let Some(camera_entity) = camera.map(TargetCamera::entity).or(default_ui_camera.get())
|
||||
|
@ -574,14 +574,17 @@ pub fn extract_uinode_borders(
|
|||
continue;
|
||||
}
|
||||
|
||||
let border_radius = resolve_border_radius(
|
||||
border_radius,
|
||||
node.size(),
|
||||
ui_logical_viewport_size,
|
||||
ui_scale.0,
|
||||
);
|
||||
|
||||
let border_radius = clamp_radius(border_radius, node.size(), border.into());
|
||||
let border_radius = if let Some(border_radius) = maybe_border_radius {
|
||||
let resolved_radius = resolve_border_radius(
|
||||
border_radius,
|
||||
node.size(),
|
||||
ui_logical_viewport_size,
|
||||
ui_scale.0,
|
||||
);
|
||||
clamp_radius(resolved_radius, node.size(), border.into())
|
||||
} else {
|
||||
[0.; 4]
|
||||
};
|
||||
let transform = global_transform.compute_matrix();
|
||||
|
||||
extracted_uinodes.uinodes.insert(
|
||||
|
|
Loading…
Reference in a new issue