mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Merge branch 'master' into cache_galley_lines
This commit is contained in:
@@ -456,11 +456,31 @@ impl Shape {
|
||||
rect_shape.blur_width *= transform.scaling;
|
||||
}
|
||||
Self::Text(text_shape) => {
|
||||
text_shape.pos = transform * text_shape.pos;
|
||||
let TextShape {
|
||||
pos,
|
||||
galley,
|
||||
underline,
|
||||
fallback_color: _,
|
||||
override_text_color: _,
|
||||
opacity_factor: _,
|
||||
angle: _,
|
||||
} = text_shape;
|
||||
|
||||
// Scale text:
|
||||
let galley = Arc::make_mut(&mut text_shape.galley);
|
||||
for placed_row in &mut galley.rows {
|
||||
*pos = transform * *pos;
|
||||
underline.width *= transform.scaling;
|
||||
|
||||
let Galley {
|
||||
job: _,
|
||||
rows,
|
||||
elided: _,
|
||||
rect,
|
||||
mesh_bounds,
|
||||
num_vertices: _,
|
||||
num_indices: _,
|
||||
pixels_per_point: _,
|
||||
} = Arc::make_mut(galley);
|
||||
|
||||
for placed_row in rows {
|
||||
let row = Arc::make_mut(&mut placed_row.row);
|
||||
row.visuals.mesh_bounds = transform.scaling * row.visuals.mesh_bounds;
|
||||
for v in &mut row.visuals.mesh.vertices {
|
||||
@@ -468,8 +488,8 @@ impl Shape {
|
||||
}
|
||||
}
|
||||
|
||||
galley.mesh_bounds = transform.scaling * galley.mesh_bounds;
|
||||
galley.rect = transform.scaling * galley.rect;
|
||||
*mesh_bounds = transform.scaling * *mesh_bounds;
|
||||
*rect = transform.scaling * *rect;
|
||||
}
|
||||
Self::Mesh(mesh) => {
|
||||
Arc::make_mut(mesh).transform(transform);
|
||||
|
||||
@@ -8,7 +8,9 @@ use crate::*;
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct TextShape {
|
||||
/// Top left corner of the first character.
|
||||
/// Where the origin of [`Self::galley`] is.
|
||||
///
|
||||
/// Usually the top left corner of the first character.
|
||||
pub pos: Pos2,
|
||||
|
||||
/// The laid out text, from [`Fonts::layout_job`].
|
||||
|
||||
Reference in New Issue
Block a user