feat(properties): show & edit block attributes in panel
Selecting an INSERT with attributes now adds an editable "Attributes" section to the Properties panel — each tag is a row whose value can be changed inline (Enter commits, undo works, the attribute text repaints). Previously attribute values could only be reached through ATTEDIT, which didn't let them be changed (#192). Attribute tags are runtime strings, so they can't ride the geometry edit path whose field key is `&'static str`; a dedicated PropValue:: AttrText variant plus PropAttrInput/PropAttrCommit messages carry the tag. Values are stored verbatim (no expression evaluation, since attribute text is free-form). Also guard the panel's in-progress edit buffer: it now only carries across a rebuild when the selection is unchanged (a commit-triggered refresh), so a typed-but-uncommitted value can't display or commit onto a different entity — e.g. two title blocks sharing a REV1 tag. This closes a latent stale-buffer leak that affected geometry fields too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3da81571a1
commit
5f2e920b75
7 changed files with 133 additions and 1 deletions
|
|
@ -31,6 +31,10 @@ pub enum PropValue {
|
|||
BoolToggle { field: &'static str, value: bool },
|
||||
/// Hatch pattern name — rendered as a combo_box from the catalog.
|
||||
HatchPatternChoice(String),
|
||||
/// Block attribute value keyed by its (dynamic, runtime) tag — rendered as
|
||||
/// an editable text_input. Unlike the other rows the routing key is the
|
||||
/// tag carried here, not the row's `&'static str` field.
|
||||
AttrText { tag: String, value: String },
|
||||
}
|
||||
|
||||
/// A single property row in the Properties panel.
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ impl Scene {
|
|||
PropValue::LinetypeChoice(s) => s,
|
||||
PropValue::HatchPatternChoice(s) => s,
|
||||
PropValue::BoolToggle { value, .. } => value.to_string(),
|
||||
PropValue::AttrText { value, .. } => value,
|
||||
PropValue::ColorVaries | PropValue::LwVaries => return None,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue