From 4aa6b8da87bca779aded5b75fdfd884954cea37b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 18:15:19 -0800 Subject: [PATCH] 3D (Classic): Reset all keeps Map Art and its options Reset all in the classic 3D dialogs reset mapArt to its empty default, which removed every map, and turned Shade Artwork and Invisible Geometry off. Like the mapped graphics and the render settings, Map Art, mapShade and mapInvisible now stay; the shape, view and lighting still reset. --- crates/ui-egui/src/dialogs/revolve.rs | 15 +++++++++++---- crates/ui-egui/src/dialogs/revolve/tests.rs | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/revolve.rs b/crates/ui-egui/src/dialogs/revolve.rs index 204f432c0e..4209915617 100644 --- a/crates/ui-egui/src/dialogs/revolve.rs +++ b/crates/ui-egui/src/dialogs/revolve.rs @@ -37,12 +37,19 @@ pub(super) fn body(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { let id = d.str("__effect"); let defaults = vectorcraft_effects::default_params(&id).unwrap_or(json!({})); - // Reset all resets the shape, view and light; the mapped graphics and the render - // settings stay. + // Reset all resets the shape, view and light; the mapped graphics, Map Art with its + // options and the render settings stay. let defaults = match defaults { Value::Object(mut m) => { - m.remove(vectorcraft_effects::GRAPHICS); - m.remove(vectorcraft_effects::RENDER); + for key in [ + vectorcraft_effects::GRAPHICS, + vectorcraft_effects::RENDER, + vectorcraft_effects::MAP_ART, + vectorcraft_effects::MAP_SHADE, + vectorcraft_effects::MAP_INVISIBLE, + ] { + m.remove(key); + } Value::Object(m) } other => other, diff --git a/crates/ui-egui/src/dialogs/revolve/tests.rs b/crates/ui-egui/src/dialogs/revolve/tests.rs index 9e01ada0d5..dd5f05ad5d 100644 --- a/crates/ui-egui/src/dialogs/revolve/tests.rs +++ b/crates/ui-egui/src/dialogs/revolve/tests.rs @@ -771,6 +771,27 @@ fn every_3d_dialog_has_color_and_reset_all_restores_white() { } } +#[test] +fn reset_all_keeps_map_art_and_its_options() { + for effect in [CLASSIC_EXTRUDE, CLASSIC_REVOLVE] { + let mut h = Harness::with("M100 100L200 100L200 200L100 200Z", effect, vec2(1280.0, 900.0)); + h.settle(); + let maps = json!([{"surface": 1, "symbol": "Mark"}]); + let d = h.app.ui.dialog.as_mut().unwrap(); + d.fields.insert("mapArt".into(), maps.clone()); + d.fields.insert("mapShade".into(), json!(true)); + d.fields.insert("mapInvisible".into(), json!(true)); + d.fields.insert("rotationX".into(), json!(40.0)); + h.settle(); + h.click(h.response("revolve-reset-all").center()); + let d = h.app.ui.dialog.as_ref().unwrap(); + assert_eq!(d.f64("rotationX", 0.0), -21.88, "{effect}: the view is reset"); + assert_eq!(d.fields.get("mapArt"), Some(&maps), "{effect}: the maps stay"); + assert!(d.bool("mapShade") && d.bool("mapInvisible"), "{effect}: Shade Artwork and Invisible Geometry stay"); + dialogs::cancel(&mut h.app); + } +} + #[test] fn light_list_add_select_edit_delete_and_reset_keep_each_light_independent() { for effect in [REVOLVE, EXTRUDE, INFLATE, vectorcraft_effects::ROTATE] {