Skip to content

Commit

Permalink
add back translate for mesh.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tweoss committed Feb 1, 2024
1 parent 227bd6a commit 5902ffd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/epaint/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ impl Mesh {
output
}

/// Translate location by this much, in-place
pub fn translate(&mut self, delta: Vec2) {
for v in &mut self.vertices {
v.pos += delta;
}
}

/// Transform the mesh in-place with the given transform.
pub fn transform(&mut self, transform: TSTransform) {
for v in &mut self.vertices {
Expand Down
2 changes: 2 additions & 0 deletions crates/epaint/src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ impl Shape {
}
Self::Text(text_shape) => {
text_shape.pos = transform * text_shape.pos;

// Scale text:
let mut galley = (*text_shape.galley).clone();
for row in &mut galley.rows {
for v in &mut row.visuals.mesh.vertices {
Expand Down

0 comments on commit 5902ffd

Please sign in to comment.