From 68a3efa83d14648cd9c9f197047717cb226f7a10 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sun, 14 Jun 2026 01:19:00 +0300 Subject: [PATCH] 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 --- src/app/properties.rs | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/app/properties.rs b/src/app/properties.rs index 064a496f0..e08d94a78 100644 --- a/src/app/properties.rs +++ b/src/app/properties.rs @@ -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 // 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).