Fix dialog header chevrons to collapse and restore forms

This commit is contained in:
lillith authored and bherbruck committed 2026-10-12 09:08:31 -04:00
1 parent db0a2a007a
commit 732447d2dc
3 files changed
+35 -1

No files matched your search

+3
View File
@@ -292,6 +292,9 @@ headline counts in-scope tabs only and lists the deferred ones separately.
continuous collision detection; local thin walls and small details remain limitations.
See [contact-set limits and recovery](docs/contact-sets.md).
Feature dialog header chevrons collapse and restore the form without discarding selections
or edited values, including the Appearance panel.
## Document-opening performance
- Cold rebuild profiling separates parsing, geometry, placement, display meshing and
+11 -1
View File
@@ -1326,7 +1326,17 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
d.collapsed = !d.collapsed;
}
ui.label(RichText::new(heading.as_str()).strong().size(12.5));
crate::frame::right_aligned(ui, total, 8.0, |ui| ui.label(RichText::new("»").color(t.text_dim)));
let chevron_width = ui.spacing().interact_size.x;
crate::frame::right_aligned(ui, total, chevron_width, |ui| {
let chevron = if d.collapsed { "«" } else { "»" };
if ui
.add(egui::Button::new(RichText::new(chevron).color(t.text_dim)).frame(false).min_size(vec2(chevron_width, 0.0)))
.on_hover_text(if d.collapsed { "Expand" } else { "Collapse" })
.clicked()
{
d.collapsed = !d.collapsed;
}
});
});
if d.collapsed {
return;
+21
View File
@@ -594,6 +594,27 @@ mod tests {
assert_eq!(a.session.doc.appearances.bodies.get("Body1"), a.session.doc.appearances.bodies.get("Body2"));
}
#[test]
fn header_chevron_folds_and_restores_appearance_inputs() {
let mut h = crate::scenario::Harness::new();
h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
h.app.session.selection = vec![Sel::Body { name: "Body1".into() }];
h.app.start("appearance.assign");
h.frames(3);
let before = h.app.dialog.clone().unwrap();
h.step(&json!({"widget":"»"})).unwrap();
assert!(h.app.dialog.as_ref().unwrap().collapsed);
assert!(h.widget("Appearance name").is_none());
h.step(&json!({"widget":"«"})).unwrap();
let after = h.app.dialog.as_ref().unwrap();
assert!(!after.collapsed);
assert_eq!(format!("{:?}", after.inputs), format!("{:?}", before.inputs));
let (Kind::Appearance(before), Kind::Appearance(after)) = (&before.kind, &after.kind) else { panic!("appearance dialog") };
assert_eq!(before.color, after.color);
assert_eq!(before.opacity, after.opacity);
assert_eq!(before.search, after.search);
}
#[test]
fn real_frames_and_unchanged_apply_keep_precise_opacity() {
let mut h = crate::scenario::Harness::new();