Fix text rotation transforms
This commit is contained in:
parent
6752df6ea4
commit
4dbe9775eb
2 changed files with 11 additions and 0 deletions
|
|
@ -554,6 +554,11 @@ fn apply_transform(t: &mut MText, tr: &EntityTransform) {
|
||||||
let line_angle = dy.atan2(dx);
|
let line_angle = dy.atan2(dx);
|
||||||
entity.rotation = 2.0 * line_angle - entity.rotation;
|
entity.rotation = 2.0 * line_angle - entity.rotation;
|
||||||
});
|
});
|
||||||
|
// Keep MTEXT's explicit rotation in sync with ROTATE / ALIGN.
|
||||||
|
if let EntityTransform::Rotate { angle_rad, .. } = tr {
|
||||||
|
t.rotation =
|
||||||
|
(t.rotation + *angle_rad).rem_euclid(std::f64::consts::TAU);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TruckConvertible for MText {
|
impl TruckConvertible for MText {
|
||||||
|
|
|
||||||
|
|
@ -484,6 +484,12 @@ fn apply_transform(t: &mut Text, tr: &EntityTransform) {
|
||||||
entity.rotation = 2.0 * line_angle - entity.rotation;
|
entity.rotation = 2.0 * line_angle - entity.rotation;
|
||||||
entity.oblique_angle = -entity.oblique_angle;
|
entity.oblique_angle = -entity.oblique_angle;
|
||||||
});
|
});
|
||||||
|
// The generic entity transform moves the TEXT geometry, but acadrust
|
||||||
|
// does not update the DXF rotation field used by our text renderer.
|
||||||
|
if let EntityTransform::Rotate { angle_rad, .. } = tr {
|
||||||
|
t.rotation =
|
||||||
|
(t.rotation + *angle_rad).rem_euclid(std::f64::consts::TAU);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TruckConvertible for Text {
|
impl TruckConvertible for Text {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue