fix(style): new mleader/table use the current style (#92)
Follow-up to the text/dimension fix: MultiLeader and Table were created at their default style too. Their styles live in the objects dictionary, so commit_entity_handle now resolves header.current_mleader_style_name / current_table_style_name to the matching style object's handle and assigns it, unless the command already set one or no such style exists. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
92e32243eb
commit
68a3efa83d
1 changed files with 50 additions and 0 deletions
|
|
@ -558,6 +558,56 @@ impl OpenCADStudio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MultiLeader / Table inherit the document's current style (#92). These
|
||||||
|
// styles live in the objects dictionary, so resolve the current style
|
||||||
|
// name to its object handle. Left untouched when the command already
|
||||||
|
// assigned a style or no matching style object exists.
|
||||||
|
match &mut entity {
|
||||||
|
acadrust::EntityType::MultiLeader(ml) if ml.style_handle.is_none() => {
|
||||||
|
let name = self.tabs[i]
|
||||||
|
.scene
|
||||||
|
.document
|
||||||
|
.header
|
||||||
|
.current_mleader_style_name
|
||||||
|
.clone();
|
||||||
|
if !name.is_empty() {
|
||||||
|
ml.style_handle =
|
||||||
|
self.tabs[i].scene.document.objects.iter().find_map(|(h, o)| {
|
||||||
|
match o {
|
||||||
|
acadrust::objects::ObjectType::MultiLeaderStyle(s)
|
||||||
|
if s.name.eq_ignore_ascii_case(&name) =>
|
||||||
|
{
|
||||||
|
Some(*h)
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
acadrust::EntityType::Table(t) if t.table_style_handle.is_none() => {
|
||||||
|
let name = self.tabs[i]
|
||||||
|
.scene
|
||||||
|
.document
|
||||||
|
.header
|
||||||
|
.current_table_style_name
|
||||||
|
.clone();
|
||||||
|
if !name.is_empty() {
|
||||||
|
t.table_style_handle =
|
||||||
|
self.tabs[i].scene.document.objects.iter().find_map(|(h, o)| {
|
||||||
|
match o {
|
||||||
|
acadrust::objects::ObjectType::TableStyle(s)
|
||||||
|
if s.name.eq_ignore_ascii_case(&name) =>
|
||||||
|
{
|
||||||
|
Some(*h)
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
// Commands pick points in local space (camera coordinates with world_offset
|
// Commands pick points in local space (camera coordinates with world_offset
|
||||||
// already subtracted). Re-add world_offset so the entity lands at the correct
|
// already subtracted). Re-add world_offset so the entity lands at the correct
|
||||||
// DXF coordinate. Skip for paper-space entities (they use sheet mm coords).
|
// DXF coordinate. Skip for paper-space entities (they use sheet mm coords).
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue