forked from 1b-agent/opencadstudio-upstream
fix(matchprop): match text style and height between TEXT/MTEXT objects (#361)
MATCHPROP only copied the generic properties (layer, color, linetype, linetype scale, lineweight), so matching text to text left the destination's style and height unchanged. Copy the source's text style and height to TEXT and MTEXT destinations, in both directions, like AutoCAD's "Text" special property. Adds an in-process regression test that drives the real interactive command path (source pick -> destination selection) and fails on the old code with the reported symptom. Fixes #361 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0907d2912d
commit
e35c557f64
2 files changed
+89
No files matched your search
@@ -759,6 +759,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");
|
||||
@@ -769,6 +782,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;
|
||||
|
||||
Reference in new issue
Block a user