fix(properties): preserve XDATA details
This commit is contained in:
parent
86a29b4b97
commit
8bceb3ecd3
1 changed files with 3 additions and 25 deletions
|
|
@ -27,27 +27,6 @@ fn visual_style_properties_text(style: &acadrust::objects::VisualStyle) -> Strin
|
||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format an XDATA value for display in the Properties panel.
|
|
||||||
fn format_xdata_value(value: &acadrust::xdata::XDataValue) -> String {
|
|
||||||
use acadrust::xdata::XDataValue;
|
|
||||||
match value {
|
|
||||||
XDataValue::String(s) => s.clone(),
|
|
||||||
XDataValue::ControlString(s) => format!("ControlString: {s}"),
|
|
||||||
XDataValue::LayerName(s) => format!("Layer: {s}"),
|
|
||||||
XDataValue::BinaryData(b) => format!("Binary: {} bytes", b.len()),
|
|
||||||
XDataValue::Handle(h) => format!("Handle: {:X}", h.value()),
|
|
||||||
XDataValue::Point3D(v)
|
|
||||||
| XDataValue::Position3D(v)
|
|
||||||
| XDataValue::Displacement3D(v)
|
|
||||||
| XDataValue::Direction3D(v) => format!("{:.6}, {:.6}, {:.6}", v.x, v.y, v.z),
|
|
||||||
XDataValue::Real(r) | XDataValue::Distance(r) | XDataValue::ScaleFactor(r) => {
|
|
||||||
format!("{r}")
|
|
||||||
}
|
|
||||||
XDataValue::Integer16(i) => format!("{i}"),
|
|
||||||
XDataValue::Integer32(i) => format!("{i}"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OpenCADStudio {
|
impl OpenCADStudio {
|
||||||
/// Rebuild the PropertiesPanel from the current entity selection.
|
/// Rebuild the PropertiesPanel from the current entity selection.
|
||||||
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
||||||
|
|
@ -634,7 +613,6 @@ impl OpenCADStudio {
|
||||||
entity,
|
entity,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Extended Data (XDATA) section: show attached app records.
|
|
||||||
{
|
{
|
||||||
use crate::entities::common::ro_prop;
|
use crate::entities::common::ro_prop;
|
||||||
let xd = &source_entity.common().extended_data;
|
let xd = &source_entity.common().extended_data;
|
||||||
|
|
@ -644,13 +622,13 @@ impl OpenCADStudio {
|
||||||
let value_text = rec
|
let value_text = rec
|
||||||
.values
|
.values
|
||||||
.iter()
|
.iter()
|
||||||
.map(format_xdata_value)
|
.map(|value| format!("{value:?}"))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
xd_props.push(ro_prop(
|
xd_props.push(ro_prop(
|
||||||
&rec.application_name,
|
t!("Application").as_ref(),
|
||||||
"xdata_value",
|
"xdata_value",
|
||||||
value_text,
|
format!("{}: {value_text}", rec.application_name),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
sections.push(crate::scene::model::object::PropSection {
|
sections.push(crate::scene::model::object::PropSection {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue