PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Auto-Align Layers: the dialog no longer sends reference 0 (#674) (#795)
reese4b80b031bc0d
diff --git a/crates/ui-egui/src/filter_dialog.rs b/crates/ui-egui/src/filter_dialog.rsindex 1c0733966..7d31cbe46 100644--- a/crates/ui-egui/src/filter_dialog.rs+++ b/crates/ui-egui/src/filter_dialog.rs@@ -85,7 +85,7 @@ pub fn parse_spec(spec: &str) -> Vec<Param> {Kind::Text} else if v == "doc" {Kind::Document- } else if v == "json" || v.starts_with('[') || v.starts_with('{') {+ } else if v == "json" || v.starts_with("layer id") || v.starts_with('[') || v.starts_with('{') {Kind::Json} else if let Some(n) = v.strip_prefix("int[").and_then(|r| r.strip_suffix(']')).and_then(|n| n.parse().ok()) {Kind::Grid(n)@@ -453,6 +453,16 @@ mod tests {);}+ /// A layer-id param has no number field: drawing the Auto-Align dialog used to write+ /// `reference: 0` back, which the engine rejects as not a selected layer (#674).+ #[test]+ fn layer_id_params_stay_out_of_the_dialog() {+ let mut f = Map::new();+ f.insert("__command".into(), json!("edit.autoAlignLayers"));+ egui::Context::default().run_ui(Default::default(), |ui| body(ui, &mut f)).textures_delta.clear();+ assert!(!params_of(&f).as_object().unwrap().contains_key("reference"), "{f:?}");+ }+#[test]fn wide_positive_ranges_use_the_logarithmic_slider_path() {assert!(uses_logarithmic_slider(0.1, 1000.0), "Gaussian Blur radius");