forked from 1b-agent/opencadstudio-upstream
Merge pull request #1431 from ramox81:codex/angular-constraint-parity (follow-up commits)
This commit is contained in:
commit
967d5ec9c2
2 files changed
+50
-8
No files matched your search
+19
-8
@@ -2160,13 +2160,12 @@ impl OpenCADStudio {
|
|||||||
// remaining style-only types stay read-only.
|
// remaining style-only types stay read-only.
|
||||||
if anno_field == "annotative" {
|
if anno_field == "annotative" {
|
||||||
match entity {
|
match entity {
|
||||||
|
// The reference offers Yes/No; the choice
|
||||||
|
// drives the same per-object toggle.
|
||||||
acadrust::EntityType::MText(t) => set_row_value(
|
acadrust::EntityType::MText(t) => set_row_value(
|
||||||
&mut sections,
|
&mut sections,
|
||||||
"annotative",
|
"annotative",
|
||||||
crate::scene::model::object::PropValue::BoolToggle {
|
yes_no_choice(t.is_annotative),
|
||||||
field: "is_annotative",
|
|
||||||
value: t.is_annotative,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
acadrust::EntityType::Dimension(
|
acadrust::EntityType::Dimension(
|
||||||
acadrust::entities::Dimension::Arc(_),
|
acadrust::entities::Dimension::Arc(_),
|
||||||
@@ -2190,10 +2189,7 @@ impl OpenCADStudio {
|
|||||||
| acadrust::EntityType::Dimension(_) => set_row_value(
|
| acadrust::EntityType::Dimension(_) => set_row_value(
|
||||||
&mut sections,
|
&mut sections,
|
||||||
"annotative",
|
"annotative",
|
||||||
crate::scene::model::object::PropValue::BoolToggle {
|
yes_no_choice(is_anno),
|
||||||
field: "annotative_ctx",
|
|
||||||
value: is_anno,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
_ => set_row(
|
_ => set_row(
|
||||||
&mut sections,
|
&mut sections,
|
||||||
@@ -2333,6 +2329,13 @@ impl OpenCADStudio {
|
|||||||
{
|
{
|
||||||
format!("{} ({})", t!("Surface"), t!("Extrusion"))
|
format!("{} ({})", t!("Surface"), t!("Extrusion"))
|
||||||
}
|
}
|
||||||
|
// The reference names an angular dimension by its kind.
|
||||||
|
acadrust::EntityType::Dimension(
|
||||||
|
acadrust::entities::Dimension::Angular2Ln(_),
|
||||||
|
) => t!("Angular Dimension").into_owned(),
|
||||||
|
acadrust::EntityType::Dimension(
|
||||||
|
acadrust::entities::Dimension::Angular3Pt(_),
|
||||||
|
) => t!("3 Point Angular Dimension").into_owned(),
|
||||||
_ => entity_type_label(entity),
|
_ => entity_type_label(entity),
|
||||||
};
|
};
|
||||||
// A dynamic dimension shows only its constraint and text
|
// A dynamic dimension shows only its constraint and text
|
||||||
@@ -3704,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
|
/// A dimensional constraint's Properties as the reference shows them: the
|
||||||
/// Constraint rows, then only the text rotation for a dynamic dimension
|
/// Constraint rows, then only the text rotation for a dynamic dimension
|
||||||
/// and the full dimension sections for an annotational one.
|
/// 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(
|
fn dynamic_dimension_sections(
|
||||||
scene: &crate::scene::Scene,
|
scene: &crate::scene::Scene,
|
||||||
handle: Handle,
|
handle: Handle,
|
||||||
|
|||||||
@@ -2245,6 +2245,37 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
|||||||
}
|
}
|
||||||
let i = self.active_tab;
|
let i = self.active_tab;
|
||||||
let handles = self.property_target_handles(i);
|
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 == crate::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 !handles.is_empty() {
|
||||||
if matches!(
|
if matches!(
|
||||||
|
|||||||
Reference in new issue
Block a user