forked from 1b-agent/fieldcraft-upstream
ui: mirror plane and images as typed fields
Two field kinds: NameOr (a name as a bare string, or an object of fields) and RefText (a text per item of a collection). The mirror's plane is a datum plane or a point and normal; its images a body name per body (#449). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
d17cf414f7
commit
98e96921e6
4 files changed
+167
-10
No files matched your search
@@ -167,6 +167,14 @@ fn scalar(f: &Field, v: &Value, units: UnitSystem) -> String {
|
||||
.join(", ")
|
||||
},
|
||||
),
|
||||
Kind::NameOr { .. } => match v {
|
||||
Value::String(s) => s.clone(),
|
||||
_ => crate::context::value_text(v),
|
||||
},
|
||||
Kind::RefText(_) => v.as_object().map_or_else(
|
||||
|| crate::context::value_text(v),
|
||||
|o| o.iter().map(|(k, x)| format!("{k}: {}", x.as_str().unwrap_or_default())).collect::<Vec<_>>().join(", "),
|
||||
),
|
||||
Kind::Either(options) => match v {
|
||||
Value::String(s) => options.iter().find(|o| o.key == s).map_or_else(|| s.clone(), |o| o.label.to_string()),
|
||||
Value::Object(o) => o
|
||||
|
||||
Reference in new issue
Block a user