mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Fix wrong mesh_bounds
This commit is contained in:
@@ -74,7 +74,7 @@ pub fn layout(fonts: &mut FontsImpl, job: Arc<LayoutJob>) -> Galley {
|
||||
return Galley {
|
||||
job,
|
||||
rows: Default::default(),
|
||||
rect: Rect::from_min_max(Pos2::ZERO, Pos2::ZERO),
|
||||
rect: Rect::ZERO,
|
||||
mesh_bounds: Rect::NOTHING,
|
||||
num_vertices: 0,
|
||||
num_indices: 0,
|
||||
@@ -655,7 +655,8 @@ fn galley_from_rows(
|
||||
for placed_row in &mut rows {
|
||||
let row = Arc::get_mut(&mut placed_row.row).unwrap();
|
||||
row.visuals = tessellate_row(point_scale, &job, &format_summary, row);
|
||||
mesh_bounds = mesh_bounds.union(row.visuals.mesh_bounds);
|
||||
mesh_bounds =
|
||||
mesh_bounds.union(row.visuals.mesh_bounds.translate(placed_row.pos.to_vec2()));
|
||||
num_vertices += row.visuals.mesh.vertices.len();
|
||||
num_indices += row.visuals.mesh.indices.len();
|
||||
}
|
||||
|
||||
@@ -872,14 +872,14 @@ impl Galley {
|
||||
rows: Vec::new(),
|
||||
elided: false,
|
||||
rect: emath::Rect::ZERO,
|
||||
mesh_bounds: emath::Rect::ZERO,
|
||||
mesh_bounds: emath::Rect::NOTHING,
|
||||
num_vertices: 0,
|
||||
num_indices: 0,
|
||||
pixels_per_point,
|
||||
};
|
||||
|
||||
for (i, galley) in galleys.iter().enumerate() {
|
||||
let current_offset = emath::vec2(0.0, merged_galley.rect.height());
|
||||
let current_offset = Vec2::new(0.0, merged_galley.rect.height());
|
||||
|
||||
let mut rows = galley.rows.iter();
|
||||
// As documented in `Row::ends_with_newline`, a '\n' will always create a
|
||||
|
||||
Reference in New Issue
Block a user