Align linear dimension properties and grips

This commit is contained in:
ramox81 committed 2026-08-24 12:10:29 +03:00
1 parent f556a2b027
commit f0d00c1d53
5 files changed
+749 -36

No files matched your search

+24 -1
View File
@@ -1021,7 +1021,11 @@ impl OpenCADStudio {
&& s.name.eq_ignore_ascii_case("Standard"))
})
{
sections.extend(crate::entities::dimension::style_sections(style));
sections.extend(crate::entities::dimension::style_sections(
style,
d,
&self.tabs[i].scene.document,
));
// The style groups are a read-only mirror, but the
// dim-line colour is an editable per-object override:
@@ -1036,6 +1040,25 @@ impl OpenCADStudio {
"dim_line_color",
PropValue::ColorChoice(dim_c),
);
for (field, code, inherited) in [
("dim_ext_line_color", dov::DIMCLRE, style.dimclre),
("dim_text_color", dov::DIMCLRT, style.dimclrt),
(
"dim_text_fill_color",
dov::DIMTFILLCLR,
style.dimtfillclr,
),
] {
let color = dov::color(&d.base().common.extended_data, code)
.unwrap_or_else(|| {
acadrust::types::Color::from_index(inherited)
});
set_row_value(
&mut sections,
field,
PropValue::ColorChoice(color),
);
}
}
}
+32 -1
View File
@@ -1140,6 +1140,7 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
if matches!(
item.action,
GripMenuAction::Stretch
| GripMenuAction::MoveWithDimLine
| GripMenuAction::MoveWithLeader
| GripMenuAction::MoveIndependent
) {
@@ -1839,7 +1840,24 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
}
self.push_undo_snapshot(i, "CHPROP");
if field == "vscale_std" {
if field.starts_with("dim_") {
for &handle in &handles {
if self.tabs[i].scene.is_layer_locked(handle) {
continue;
}
if matches!(
self.tabs[i].scene.document.get_entity(handle),
Some(acadrust::EntityType::Dimension(_))
) {
crate::entities::dim_override::set_property(
&mut self.tabs[i].scene.document,
handle,
field,
&value,
);
}
}
} else if field == "vscale_std" {
for &handle in &handles {
if matches!(
self.tabs[i].scene.document.get_entity(handle),
@@ -2410,6 +2428,19 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
continue;
}
match field {
_ if field.starts_with("dim_") => {
if matches!(
self.tabs[i].scene.document.get_entity(handle),
Some(acadrust::EntityType::Dimension(_))
) {
crate::entities::dim_override::set_property(
&mut self.tabs[i].scene.document,
handle,
field,
&val,
);
}
}
"hyperlink" => {
// Stored in the standard PE_URL XDATA
// record; an empty value clears it.
+14 -2
View File
@@ -4834,8 +4834,20 @@ impl OpenCADStudio {
// line with the rest of the dim-colour stack (index-only through
// the file layer). Guarded to leaders / dimensions so a mixed
// selection can't stamp the override onto other entities.
if field == "dim_line_color" {
if matches!(
field.as_str(),
"dim_line_color"
| "dim_ext_line_color"
| "dim_text_color"
| "dim_text_fill_color"
) {
let aci = color.approximate_index();
let code = match field.as_str() {
"dim_ext_line_color" => crate::entities::dim_override::DIMCLRE,
"dim_text_color" => crate::entities::dim_override::DIMCLRT,
"dim_text_fill_color" => crate::entities::dim_override::DIMTFILLCLR,
_ => crate::entities::dim_override::DIMCLRD,
};
let targets: Vec<acadrust::Handle> = handles
.iter()
.copied()
@@ -4853,7 +4865,7 @@ impl OpenCADStudio {
crate::entities::dim_override::set(
&mut self.tabs[i].scene.document,
handle,
crate::entities::dim_override::DIMCLRD,
code,
Some(acadrust::xdata::XDataValue::Integer16(aci)),
);
}