Skip to content

Commit

Permalink
Remove the With<Parent> query filter from `bevy_ui::render::extract…
Browse files Browse the repository at this point in the history
…_uinode_borders` (#9285)

# Objective

Remove the `With<Parent>` query filter from the `parent_node_query`
parameter of the `bevy_ui::render::extract_uinode_borders` function.
This is a bug, the query is only used to retrieve the size of the
current node's parent. We don't care if that parent node has a `Parent`
or not.

---------

Co-authored-by: François <mockersf@gmail.com>
  • Loading branch information
2 people authored and cart committed Aug 10, 2023
1 parent ac41ba6 commit 5b379d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn extract_uinode_borders(
Without<ContentSize>,
>,
>,
parent_node_query: Extract<Query<&Node, With<Parent>>>,
node_query: Extract<Query<&Node>>,
) {
let image = bevy_render::texture::DEFAULT_IMAGE_HANDLE.typed();

Expand Down Expand Up @@ -304,7 +304,7 @@ pub fn extract_uinode_borders(
// Both vertical and horizontal percentage border values are calculated based on the width of the parent node
// <https://developer.mozilla.org/en-US/docs/Web/CSS/border-width>
let parent_width = parent
.and_then(|parent| parent_node_query.get(parent.get()).ok())
.and_then(|parent| node_query.get(parent.get()).ok())
.map(|parent_node| parent_node.size().x)
.unwrap_or(ui_logical_viewport_size.x);
let left =
Expand Down

0 comments on commit 5b379d9

Please sign in to comment.