forked from 1b-agent/opencadstudio-upstream
Route dimension color fields correctly
This commit is contained in:
1 parent
c66ec7fb64
commit
80d7a8741e
12 files changed
+89
-8
No files matched your search
@@ -1218,6 +1218,8 @@ pub enum ColorPickTarget {
|
||||
Properties,
|
||||
/// Selected entities' background colour (hatch / MTEXT background row).
|
||||
PropertiesBg,
|
||||
/// A named per-entity Properties colour field.
|
||||
PropertiesField(String),
|
||||
/// Current creation colour (ribbon).
|
||||
Ribbon,
|
||||
/// A layer's colour, by panel row index.
|
||||
|
||||
@@ -4841,6 +4841,11 @@ impl OpenCADStudio {
|
||||
| "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,
|
||||
@@ -4862,6 +4867,19 @@ 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,
|
||||
@@ -7539,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()
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -474,6 +474,7 @@ fn mtext_editor_content<'a>(
|
||||
crate::ui::color_select::ColorExtras {
|
||||
by_layer: true,
|
||||
by_block: false,
|
||||
..Default::default()
|
||||
},
|
||||
Message::MTextColorChanged,
|
||||
Message::MTextColorPickerToggle,
|
||||
|
||||
Reference in new issue
Block a user