From ca152de1c0cdd4ecaf70653fc9feea20e246818a Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 7 Aug 2026 11:48:53 +0300 Subject: [PATCH] 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 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/entities/mtext.rs | 5 ----- src/entities/text.rs | 6 ------ 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad401f063..cc262a188 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,7 +85,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" [[package]] name = "acadrust" version = "0.4.0" -source = "git+https://github.com/OpenAEC-Foundation/acadifc.git?rev=41149d7#41149d7ee06c56fd7472bf3c234b1fbba2ba5cde" +source = "git+https://github.com/OpenAEC-Foundation/acadifc.git?rev=9ecaffc#9ecaffc3f5c32bad61c9624b6acb03afe97a2863" dependencies = [ "ahash 0.8.12", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index b2758037b..c654e58d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_Window ashpd = { version = "0.13.13", default-features = false, features = ["async-io", "wayland"] } [patch.crates-io] -acadrust = { git = "https://github.com/OpenAEC-Foundation/acadifc.git", rev = "41149d7" } +acadrust = { git = "https://github.com/OpenAEC-Foundation/acadifc.git", rev = "9ecaffc" } iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" } iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" } diff --git a/src/entities/mtext.rs b/src/entities/mtext.rs index 82e9ab0d7..74b2dfcbb 100644 --- a/src/entities/mtext.rs +++ b/src/entities/mtext.rs @@ -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 { diff --git a/src/entities/text.rs b/src/entities/text.rs index 087ba9660..7b47673ea 100644 --- a/src/entities/text.rs +++ b/src/entities/text.rs @@ -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 {