Merge pull request #384 from KevinGriffin-new/fix/matchprop-text

Match text style and height between TEXT/MTEXT objects (#361).

MATCHPROP copied only the generic properties, so Text->Text and
Text->MText matching left the destination's style and height unchanged.
The MatchProperties handler now also carries style + height between
text-like objects, both directions, like AutoCAD's "Text" special
property. bump_geometry re-tessellates so matched text repaints at its
new size.

Conflict: the fix (command_driver.rs) auto-merged; only the additive
test block in automation.rs conflicted with tests main added since the
PR branched. Resolved by keeping all four tests.

# Conflicts:
#	src/app/automation.rs
This commit is contained in:
Hakan Seven committed 2026-07-16 11:33:46 +03:00
commit 5afee1d71f
2 files changed
+89

No files matched your search

+26
View File
@@ -793,6 +793,19 @@ impl OpenCADStudio {
c.line_weight,
)
});
// Text-specific properties travel between text-like objects
// (TEXT ↔ MTEXT, both directions), like AutoCAD's "Text"
// special property (#361).
let text_props =
self.tabs[i]
.scene
.document
.get_entity(src)
.and_then(|e| match e {
acadrust::EntityType::Text(t) => Some((t.style.clone(), t.height)),
acadrust::EntityType::MText(m) => Some((m.style.clone(), m.height)),
_ => None,
});
if let Some((layer, color, linetype, lt_scale, lw)) = props {
self.push_undo_snapshot(i, "MATCHPROP");
@@ -803,6 +816,19 @@ impl OpenCADStudio {
crate::scene::view::dispatch::apply_line_weight(e, lw);
e.common_mut().linetype = linetype.clone();
e.common_mut().linetype_scale = lt_scale;
if let Some((style, height)) = &text_props {
match e {
acadrust::EntityType::Text(t) => {
t.style = style.clone();
t.height = *height;
}
acadrust::EntityType::MText(m) => {
m.style = style.clone();
m.height = *height;
}
_ => {}
}
}
}
}
self.tabs[i].dirty = true;