From bdcd24179b8da2c797fe175fa09d0465bafb448c Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 22 Sep 2026 12:49:28 +0300 Subject: [PATCH] Annotative as a Yes/No list in Properties The Annotative row of text, MText, blocks, leaders, hatches and dimensions is a Yes/No list, as the reference shows it; choosing a value drives the same per-object annotative toggle as before. Co-Authored-By: Claude Fable 5.1 --- src/app/properties.rs | 20 ++++++++++++-------- src/app/update/command.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/app/properties.rs b/src/app/properties.rs index a34f8d668..fd29ab28b 100644 --- a/src/app/properties.rs +++ b/src/app/properties.rs @@ -2160,13 +2160,12 @@ impl OpenCADStudio { // remaining style-only types stay read-only. if anno_field == "annotative" { match entity { + // The reference offers Yes/No; the choice + // drives the same per-object toggle. acadrust::EntityType::MText(t) => set_row_value( &mut sections, "annotative", - crate::scene::model::object::PropValue::BoolToggle { - field: "is_annotative", - value: t.is_annotative, - }, + yes_no_choice(t.is_annotative), ), acadrust::EntityType::Dimension( acadrust::entities::Dimension::Arc(_), @@ -2190,10 +2189,7 @@ impl OpenCADStudio { | acadrust::EntityType::Dimension(_) => set_row_value( &mut sections, "annotative", - crate::scene::model::object::PropValue::BoolToggle { - field: "annotative_ctx", - value: is_anno, - }, + yes_no_choice(is_anno), ), _ => set_row( &mut sections, @@ -3711,6 +3707,14 @@ fn set_row(sections: &mut [crate::scene::model::object::PropSection], field: &st /// A dimensional constraint's Properties as the reference shows them: the /// Constraint rows, then only the text rotation for a dynamic dimension /// and the full dimension sections for an annotational one. +/// A Yes/No list row, as the reference shows on/off object properties. +fn yes_no_choice(flag: bool) -> crate::scene::model::object::PropValue { + crate::scene::model::object::PropValue::Choice { + selected: if flag { t!("Yes") } else { t!("No") }.into_owned(), + options: vec![t!("Yes").into_owned(), t!("No").into_owned()], + } +} + fn dynamic_dimension_sections( scene: &crate::scene::Scene, handle: Handle, diff --git a/src/app/update/command.rs b/src/app/update/command.rs index fc7ba2ebb..3822f835e 100644 --- a/src/app/update/command.rs +++ b/src/app/update/command.rs @@ -2193,6 +2193,36 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task { } let i = self.active_tab; let handles = self.property_target_handles(i); + // The Annotative Yes/No list drives the per-object annotative toggle + // (MTEXT's own flag, the annotation context for the rest). + if field == "annotative" { + let wanted = value == t!("Yes").as_ref() || value.eq_ignore_ascii_case("yes"); + let Some(handle) = handles.first().copied() else { + return Task::none(); + }; + let document = &self.tabs[i].scene.document; + let (toggle, current) = match document.get_entity(handle) { + Some(acadrust::EntityType::MText(text)) => ("is_annotative", text.is_annotative), + Some(entity) => ( + "annotative_ctx", + crate::scene::annotative::is_annotative(document, entity) + || match entity { + acadrust::EntityType::Dimension(dimension) => { + crate::scene::annotative::dim_style_is_annotative( + document, + &dimension.base().style_name, + ) + } + _ => false, + }, + ), + None => return Task::none(), + }; + if wanted != current { + return self.update(Message::PropBoolToggle(toggle)); + } + return Task::none(); + } if !handles.is_empty() { if matches!(