don't use padding for layout (#14944)

# Objective

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

## Solution

- Remove extra computation added in
https://github.com/bevyengine/bevy/pull/14777
This commit is contained in:
François Mockers 2024-08-28 00:41:23 +02:00 committed by GitHub
parent 9cdb915809
commit e63d7c340f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -264,16 +264,10 @@ pub fn ui_layout_system(
let Ok(layout) = ui_surface.get_layout(entity) else { let Ok(layout) = ui_surface.get_layout(entity) else {
return; return;
}; };
let layout_size = inverse_target_scale_factor let layout_size =
* Vec2::new( inverse_target_scale_factor * Vec2::new(layout.size.width, layout.size.height);
layout.size.width - layout.padding.left - layout.padding.right, let layout_location =
layout.size.height - layout.padding.top - layout.padding.bottom, inverse_target_scale_factor * Vec2::new(layout.location.x, layout.location.y);
);
let layout_location = inverse_target_scale_factor
* Vec2::new(
layout.location.x + layout.padding.left,
layout.location.y + layout.padding.top,
);
absolute_location += layout_location; absolute_location += layout_location;