mirror of
https://github.com/emilk/egui.git
synced 2026-06-28 15:33:14 -04:00
Add Image::rotate and Mesh::rotate (#1371)
Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
This commit is contained in:
@@ -254,6 +254,15 @@ impl Mesh {
|
||||
v.pos += delta;
|
||||
}
|
||||
}
|
||||
|
||||
/// Rotate by some angle about an origin, in-place.
|
||||
///
|
||||
/// Origin is a position in screen space.
|
||||
pub fn rotate(&mut self, rot: Rot2, origin: Pos2) {
|
||||
for v in &mut self.vertices {
|
||||
v.pos = origin + rot * (v.pos - origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user