forked from 1b-agent/opencadstudio-upstream
feat(props): make dim-line colour editable for leaders and dimensions
The "Dim line color" row on Leader and Dimension entities was read-only: an earlier attempt wired it to Leader.override_color, which acadrust never serialises, so the pick was lost on save. Store it instead as a standard ACAD_DSTYLE per-object dimension-style override (DXF code 176, an ACI index) through the existing dim_override codec, so it round-trips through both DWG and DXF like the other dim overrides. RGB picks collapse to the nearest ACI, matching the rest of the dim-colour stack (dimension styles are index-only through the file layer). The renderer prefers the override over the style's DIMCLRD. The write branch is guarded to leaders and dimensions so a mixed selection cannot stamp the override onto other entity types. Bumps acadrust to c9fe982, which carries parsed XDATA onto dimensions on DXF read (it was dropping common.extended_data), so the dimension override persists on DXF save as well as DWG. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
04bd49c715
commit
d005cc4ab1
8 files changed
+241
-29
No files matched your search
@@ -1290,11 +1290,18 @@ fn tessellate_dimension_inner(
|
||||
);
|
||||
|
||||
// Per-spec colours: DIMCLRD (dim/arrows), DIMCLRE (ext), DIMCLRT (text).
|
||||
// 0=ByBlock and 256=ByLayer fall through to entity_color.
|
||||
// 0=ByBlock and 256=ByLayer fall through to entity_color. DIMCLRD also
|
||||
// honours a per-object ACAD_DSTYLE override (code 176) so an edited
|
||||
// dim-line colour renders even without touching the style.
|
||||
let dim_color = if selected {
|
||||
WireModel::SELECTED
|
||||
} else {
|
||||
resolve_dim_color(style.map(|s| s.dimclrd).unwrap_or(0), entity_color)
|
||||
let dim_clr = crate::entities::dim_override::int(
|
||||
&dim.base().common.extended_data,
|
||||
crate::entities::dim_override::DIMCLRD,
|
||||
)
|
||||
.unwrap_or_else(|| style.map(|s| s.dimclrd).unwrap_or(0));
|
||||
resolve_dim_color(dim_clr, entity_color)
|
||||
};
|
||||
let ext_color = if selected {
|
||||
WireModel::SELECTED
|
||||
|
||||
Reference in new issue
Block a user