mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 07:10:04 -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;
|
rect_shape.blur_width *= transform.scaling;
|
||||||
}
|
}
|
||||||
Self::Text(text_shape) => {
|
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:
|
*pos = transform * *pos;
|
||||||
let galley = Arc::make_mut(&mut text_shape.galley);
|
underline.width *= transform.scaling;
|
||||||
for placed_row in &mut galley.rows {
|
|
||||||
|
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);
|
let row = Arc::make_mut(&mut placed_row.row);
|
||||||
row.visuals.mesh_bounds = transform.scaling * row.visuals.mesh_bounds;
|
row.visuals.mesh_bounds = transform.scaling * row.visuals.mesh_bounds;
|
||||||
for v in &mut row.visuals.mesh.vertices {
|
for v in &mut row.visuals.mesh.vertices {
|
||||||
@@ -468,8 +488,8 @@ impl Shape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
galley.mesh_bounds = transform.scaling * galley.mesh_bounds;
|
*mesh_bounds = transform.scaling * *mesh_bounds;
|
||||||
galley.rect = transform.scaling * galley.rect;
|
*rect = transform.scaling * *rect;
|
||||||
}
|
}
|
||||||
Self::Mesh(mesh) => {
|
Self::Mesh(mesh) => {
|
||||||
Arc::make_mut(mesh).transform(transform);
|
Arc::make_mut(mesh).transform(transform);
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ use crate::*;
|
|||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
pub struct TextShape {
|
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,
|
pub pos: Pos2,
|
||||||
|
|
||||||
/// The laid out text, from [`Fonts::layout_job`].
|
/// The laid out text, from [`Fonts::layout_job`].
|
||||||
|
|||||||
Reference in New Issue
Block a user