Skip to content

Commit

Permalink
Remove the coordinate rounding from extract_text_sections. The coor… (
Browse files Browse the repository at this point in the history
#16616)

# Objective

Remove the coordinate rounding from `extract_text_sections`. The
coordinates are already rounded during the layout update.
  • Loading branch information
ickshonpe authored Dec 12, 2024
1 parent d132239 commit 116c2b0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,8 @@ pub fn extract_text_sections(
continue;
};

// Align the text to the nearest pixel:
// * Translate by minus the text node's half-size
// (The transform translates to the center of the node but the text coordinates are relative to the node's top left corner)
// * Round the position to the nearest physical pixel

let mut transform = global_transform.affine()
let transform = global_transform.affine()
* bevy_math::Affine3A::from_translation((-0.5 * uinode.size()).extend(0.));
transform.translation = transform.translation.round();

let mut color = LinearRgba::WHITE;
let mut current_span = usize::MAX;
Expand Down

0 comments on commit 116c2b0

Please sign in to comment.