forked from 1b-agent/opencadstudio-upstream
refactor(text): let acadrust carry the rotation through a transform
The merged fix added the rotation update on this side, matching only `EntityTransform::Rotate`. That left `Affine` -- which several entity paths and the UCS world transform emit -- still dropping the angle, and it sat against the contract this crate already relies on: MIRROR is delegated precisely because acadrust's entity-aware paths "handle direction flags, stored-angle conventions and bulges themselves", and `mirror_text` did exactly that for the same field. Moved upstream (acadrust 9ecaffc), where one helper carries the angle for every entity that keeps one. That covers rotation, affine and reflection in a single place, and closes the same gap for SHAPE and the ATTRIB pair, which a rotation left facing the old way too -- attributes noticeably so, since INSERT already turned itself while its attributes did not. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
05f875b1ff
commit
ca152de1c0
4 files changed
+2
-13
No files matched your search
@@ -554,11 +554,6 @@ fn apply_transform(t: &mut MText, tr: &EntityTransform) {
|
||||
let line_angle = dy.atan2(dx);
|
||||
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 {
|
||||
|
||||
@@ -484,12 +484,6 @@ fn apply_transform(t: &mut Text, tr: &EntityTransform) {
|
||||
entity.rotation = 2.0 * line_angle - entity.rotation;
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user