feat(dimension): complete linear workflow

This commit is contained in:
Hakan Seven committed 2026-08-24 23:42:49 +03:00
commit 959197bb3c
22 files changed
+2576 -258

No files matched your search

+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.
+33 -2
View File
@@ -4834,8 +4834,25 @@ 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 fill_mode = (field == "dim_text_fill_color").then(|| match color {
acadrust::types::Color::None => 0,
acadrust::types::Color::ByBlock => 1,
_ => 2,
});
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()
@@ -4850,10 +4867,23 @@ impl OpenCADStudio {
if !targets.is_empty() {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &targets {
if field == "dim_text_fill_color" {
crate::entities::dim_override::set(
&mut self.tabs[i].scene.document,
handle,
crate::entities::dim_override::DIMTFILL,
Some(acadrust::xdata::XDataValue::Integer16(
fill_mode.unwrap_or(2),
)),
);
if fill_mode != Some(2) {
continue;
}
}
crate::entities::dim_override::set(
&mut self.tabs[i].scene.document,
handle,
crate::entities::dim_override::DIMCLRD,
code,
Some(acadrust::xdata::XDataValue::Integer16(aci)),
);
}
@@ -7527,6 +7557,7 @@ impl OpenCADStudio {
let i = self.active_tab;
self.tabs[i].properties.color_picker_open = false;
self.tabs[i].properties.open_color_field = None;
self.tabs[i].layers.color_picker_row = None;
Task::none()
+3
View File
@@ -1146,6 +1146,9 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
Some(crate::app::ColorPickTarget::PropertiesBg) => {
Some(Message::PropBgColorChanged(color))
}
Some(crate::app::ColorPickTarget::PropertiesField(field)) => {
Some(Message::PropColorFieldChanged { field, color })
}
Some(crate::app::ColorPickTarget::MText) => {
Some(Message::MTextColorChanged(color))
}