1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Replace a hack with a proper implementation

This commit is contained in:
Fishhh
2024-11-30 19:23:32 +01:00
parent 110a9c39e3
commit 139f28640d
2 changed files with 13 additions and 31 deletions

View File

@@ -730,7 +730,7 @@ impl GalleyCache {
fn layout_multiline(&mut self, fonts: &mut FontsImpl, job: LayoutJob) -> Galley {
let pixels_per_point = fonts.pixels_per_point;
let round_to_pixel =
move |point: emath::Pos2| (point * pixels_per_point).round() / pixels_per_point;
move |point: f32| (point * pixels_per_point).round() / pixels_per_point;
let mut current_section = 0;
let mut current = 0;
@@ -816,7 +816,8 @@ impl GalleyCache {
}
merged_galley.rows.extend(rows.map(|placed_row| {
let new_pos = round_to_pixel(placed_row.pos + current_offset);
let mut new_pos = placed_row.pos + current_offset;
new_pos.y = round_to_pixel(new_pos.y);
merged_galley.mesh_bounds = merged_galley
.mesh_bounds
.union(placed_row.visuals.mesh_bounds.translate(new_pos.to_vec2()));