Skip to content

Commit

Permalink
Use logical units for Node's translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ickshonpe committed Dec 2, 2024
1 parent 6847c51 commit ff39bd4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/bevy_ui/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,16 @@ with UI components as a child of an entity without UI components, your UI layout
bottom: rect.bottom,
};

transform *=
style.transform.compute_matrix() * Mat4::from_translation(node_center.extend(0.));

node.bypass_change_detection().border = taffy_rect_to_border_rect(layout.border);
node.bypass_change_detection().padding = taffy_rect_to_border_rect(layout.padding);

let new_transform = GlobalTransform::from(transform);
if new_transform != *global_transform {
*global_transform = new_transform;
let mut node_transform = style.transform;
node_transform.translation /= inverse_target_scale_factor;
transform *=
node_transform.compute_matrix() * Mat4::from_translation(node_center.extend(0.));
let new_global_transform = GlobalTransform::from(transform);
if new_global_transform != *global_transform {
*global_transform = new_global_transform;
}

let viewport_size = root_size.unwrap_or(node.size);
Expand Down

0 comments on commit ff39bd4

Please sign in to comment.