diff --git a/crates/ui-egui/src/dialogs/path_ops.rs b/crates/ui-egui/src/dialogs/path_ops.rs index c46096a00..b3197b5cb 100644 --- a/crates/ui-egui/src/dialogs/path_ops.rs +++ b/crates/ui-egui/src/dialogs/path_ops.rs @@ -193,7 +193,9 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { } // The fields as the dialog held them, so they show as typed when it opens again. if d.kind == "offsetPath" { - let kept = ["offset", "joins", "miterLimit"].into_iter().filter_map(|k| Some((k.to_string(), d.fields.get(k)?.clone()))); + // Preview among them: the checkbox keeps its last state across opens (#3195), as + // Simplify's retained fields keep theirs. + let kept = ["offset", "joins", "miterLimit", "preview"].into_iter().filter_map(|k| Some((k.to_string(), d.fields.get(k)?.clone()))); app.ui.offset_path = Value::Object(kept.collect()); } Ok(r) diff --git a/crates/ui-egui/src/dialogs/tests_modal.rs b/crates/ui-egui/src/dialogs/tests_modal.rs index 883194916..6008b0724 100644 --- a/crates/ui-egui/src/dialogs/tests_modal.rs +++ b/crates/ui-egui/src/dialogs/tests_modal.rs @@ -284,6 +284,21 @@ fn offset_path_remembers_its_last_values() { assert_eq!((d.f64("offset", 0.0), d.str("joins"), d.f64("miterLimit", 0.0)), (-4.5, "round".to_string(), 4.0)); } +/// Offset Path's Preview checkbox keeps its last state across opens, like the other fields (#3195). +#[test] +fn offset_path_remembers_its_last_preview_state() { + let mut app = app_with_selection(); + app.run("select.all", json!({})).unwrap(); + crate::menus::invoke(&mut app, "object.path.offsetPath", json!({})); + let d = app.ui.dialog.as_mut().unwrap(); + assert!(!d.bool("preview"), "a first open is unchecked"); + d.fields.insert("preview".into(), json!(true)); + confirm(&mut app).unwrap(); + crate::menus::invoke(&mut app, "object.path.offsetPath", json!({})); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(d.bool("preview"), "the state it was confirmed with"); +} + fn app_with_dense_path() -> VectorcraftApp { let mut app = VectorcraftApp::new(Session::new(), Default::default()); app.run("file.new", json!({"width": 400, "height": 300})).unwrap();