Skip to content

Commit

Permalink
don't use padding for layout (#14944)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #14792 
- Padding is already handled by taffy, don't handle it also on Bevy side

## Solution

- Remove extra computation added in
#14777
  • Loading branch information
mockersf authored Aug 27, 2024
1 parent 9cdb915 commit e63d7c3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions crates/bevy_ui/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,10 @@ pub fn ui_layout_system(
let Ok(layout) = ui_surface.get_layout(entity) else {
return;
};
let layout_size = inverse_target_scale_factor
* Vec2::new(
layout.size.width - layout.padding.left - layout.padding.right,
layout.size.height - layout.padding.top - layout.padding.bottom,
);
let layout_location = inverse_target_scale_factor
* Vec2::new(
layout.location.x + layout.padding.left,
layout.location.y + layout.padding.top,
);
let layout_size =
inverse_target_scale_factor * Vec2::new(layout.size.width, layout.size.height);
let layout_location =
inverse_target_scale_factor * Vec2::new(layout.location.x, layout.location.y);

absolute_location += layout_location;

Expand Down

0 comments on commit e63d7c3

Please sign in to comment.