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:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-16 01:51:04 -04:00
1 parent d17cf414f7
commit 98e96921e6
4 files changed
+167 -10

No files matched your search

+8
View File
@@ -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