From e854481f7288083b60f21611cb1ed5b745aa22c5 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Wed, 7 Oct 2026 08:49:40 +0300 Subject: [PATCH] fix(mirror): a mirrored dimension keeps its text readable The dimension's own block parts were mirrored with their text, so the measurement read backwards. Text orientation is kept under reflection, the same as TEXT and MTEXT with MIRRTEXT off. Fixes #1639 Co-Authored-By: Claude Opus 5.5 --- src/scene/modify.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/scene/modify.rs b/src/scene/modify.rs index d3d035ace..97dbb38af 100644 --- a/src/scene/modify.rs +++ b/src/scene/modify.rs @@ -107,6 +107,18 @@ fn mirror_true_text_flags(e: &mut EntityType) { } } +/// Transform one entity of a dimension's `*D` block. Its text reads the +/// right way after a mirror, whatever MIRRTEXT says. +fn transform_dimension_part(entity: &mut EntityType, t: &EntityTransform) { + let orient = matches!(t, EntityTransform::Mirror { .. }) + .then(|| capture_text_orient(entity)) + .flatten(); + view::dispatch::apply_transform(entity, t); + if let Some(orient) = orient { + restore_text_orient(entity, &orient); + } +} + impl Scene { pub(crate) fn sync_displayed_annotation_context(&mut self, handle: Handle) -> bool { let scale = self.displayed_annotation_scale_handle(); @@ -357,7 +369,7 @@ impl Scene { self.record_undo_before(*h, before); } if let Some(entity) = self.document.get_entity_mut(*h) { - view::dispatch::apply_transform(entity, t); + transform_dimension_part(entity, t); } } // The moved `*D` contents are a block definition the block cache holds; @@ -639,7 +651,7 @@ impl Scene { .ok()?; for sub in subs { let mut sub = sub.clone(); - view::dispatch::apply_transform(&mut sub, t); + transform_dimension_part(&mut sub, t); Self::reset_clone_subhandles(&mut self.document, &mut sub); sub.common_mut().handle = Handle::NULL; sub.common_mut().owner_handle = br_handle;