From 61c52c08db3bbfc0de79ba78ee8dc645ddf5567b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arif=20U=C4=9Fur=20=C3=87elik?= Date: Tue, 13 Oct 2026 02:23:17 +0300 Subject: [PATCH] Brush Settings: toggle switch rows without losing smoothing settings (#4463) Noise, Wet Edges, Build-up, Smoothing and Protect Texture toggle from anywhere on their row while keeping the selected controls open. Keep lock clicks independent and expose each switch as one accessible checkbox. Give Smoothing a default-on enable flag so disabling it preserves the amount and modes. Old brush JSON stays compatible; toolbar amount edits and explicit stroke overrides enable it, and ABR imports retain disabled smoothing values. Cover row, checkbox, lock and keyboard gestures, old section selections, command replay, presets, legacy JSON and 8/16/32-bit rendering. Fixes #4283 Co-authored-by: augrclk <217665348+augrclk@users.noreply.github.com> Co-authored-by: GPT-6 Co-authored-by: Brandon Thomas --- crates/engine/src/brush_cmds.rs | 1 + crates/engine/tests/brush_smoothing.rs | 34 ++++++ crates/io/src/abr_map.rs | 5 +- crates/io/src/abr_map/tests.rs | 22 ++++ crates/paint/src/brush.rs | 4 +- crates/paint/src/brush_tests.rs | 33 ++++++ crates/paint/src/dynamics.rs | 2 +- crates/ui-egui/src/brush_panel.rs | 60 ++++++++--- crates/ui-egui/src/brush_panel_tests.rs | 134 ++++++++++++++++++++++++ crates/ui-egui/src/panels.rs | 1 + docs/brush-parity.md | 4 +- docs/gaps.md | 6 +- 12 files changed, 282 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/brush_cmds.rs b/crates/engine/src/brush_cmds.rs index dd5c46608c..16b7d72a29 100644 --- a/crates/engine/src/brush_cmds.rs +++ b/crates/engine/src/brush_cmds.rs @@ -200,6 +200,7 @@ pub fn resolve_brush(s: &Session, p: &Value, cmd: &str) -> Result b.spacing = v.clamp(0.01, 10.0); } if let Some(v) = num(p, "smoothing") { + b.smoothing.enabled = true; b.smoothing.amount = v.clamp(0.0, 1.0); } b.color = color(p.get("color"), s.tools.foreground); diff --git a/crates/engine/tests/brush_smoothing.rs b/crates/engine/tests/brush_smoothing.rs index bb624daa7f..b39a7b285f 100644 --- a/crates/engine/tests/brush_smoothing.rs +++ b/crates/engine/tests/brush_smoothing.rs @@ -20,3 +20,37 @@ fn presets_keep_the_tool_smoothing() { s.execute("tools.setBrush", json!({"preset": preset, "brush": {"smoothing": {"amount": 0.0}}})).unwrap(); assert_eq!(s.tools.brush.smoothing.amount, 0.0); } + +#[test] +fn smoothing_switch_is_drivable_and_presets_keep_the_disabled_settings() { + let mut s = Session::new(); + let params = json!({"brush": {"smoothing": {"enabled": false, "amount": 0.6, "pulledString": true, "catchUpOnEnd": false}}}); + s.execute("tools.setBrush", params.clone()).unwrap(); + let off = s.tools.brush.smoothing.clone(); + assert!(!off.enabled && off.amount == 0.6 && off.pulled_string && !off.catch_up_on_end); + let preset = s.tools.presets[0].name.clone(); + s.execute("tools.setBrush", json!({"preset": preset})).unwrap(); + assert_eq!(s.tools.brush.smoothing, off); + s.execute("tools.setBrush", json!({"brush": {"smoothing": {"enabled": true}}})).unwrap(); + assert!(s.tools.brush.smoothing.enabled); + assert_eq!(s.tools.brush.smoothing.amount, off.amount); + assert_eq!(s.tools.brush.smoothing.pulled_string, off.pulled_string); + // The same parameter patch reproduces the off state in another session (CLI/MCP path). + let mut other = Session::new(); + other.execute("tools.setBrush", params).unwrap(); + assert_eq!(other.tools.brush.smoothing, off); + let before = other.tools.brush.clone(); + assert!(other.execute("tools.setBrush", json!({"brush": {"smoothing": {"enabled": "no"}}})).is_err()); + assert_eq!(other.tools.brush, before); +} + +#[test] +fn an_explicit_stroke_smoothing_amount_overrides_the_tool_switch() { + let mut s = Session::new(); + s.execute("tools.setBrush", json!({"brush": {"smoothing": {"enabled": false, "amount": 0.6}}})).unwrap(); + let inherited = photocraft_engine::brush_cmds::resolve_brush(&s, &json!({}), "paint.stroke").unwrap(); + assert!(!inherited.smoothing.enabled && inherited.smoothing.amount == 0.6); + let explicit = photocraft_engine::brush_cmds::resolve_brush(&s, &json!({"smoothing": 0.4}), "paint.stroke").unwrap(); + assert!(explicit.smoothing.enabled && explicit.smoothing.amount == 0.4); + assert!(!s.tools.brush.smoothing.enabled, "a stroke override does not change the tool"); +} diff --git a/crates/io/src/abr_map.rs b/crates/io/src/abr_map.rs index 6230e27649..9338d110a2 100644 --- a/crates/io/src/abr_map.rs +++ b/crates/io/src/abr_map.rs @@ -478,9 +478,8 @@ impl Mapper<'_> { } b.pressure_size = boolean(to, "usePressureOverridesSize").unwrap_or(false); b.pressure_opacity = boolean(to, "usePressureOverridesOpacity").unwrap_or(false); - if boolean(to, "smoothing").unwrap_or(true) - && let Some(v) = pct(to, "smoothingValue") - { + b.smoothing.enabled = boolean(to, "smoothing").unwrap_or(true); + if let Some(v) = pct(to, "smoothingValue") { b.smoothing.amount = v.clamp(0.0, 1.0); } if let Some(v) = boolean(to, "smoothingRadiusMode") { diff --git a/crates/io/src/abr_map/tests.rs b/crates/io/src/abr_map/tests.rs index 013f307f81..a97193457c 100644 --- a/crates/io/src/abr_map/tests.rs +++ b/crates/io/src/abr_map/tests.rs @@ -188,6 +188,28 @@ fn missing_pattern_and_tip_are_reported() { assert!(imp.warnings.iter().any(|w| w.contains("Orphan")), "{:?}", imp.warnings); } +#[test] +fn disabled_smoothing_tool_options_keep_the_amount_and_mode() { + let preset = Descriptor::new("brushPreset") + .with("Nm ", t("Smoothing off")) + .with("Brsh", Value::Descriptor(Descriptor::new("computedBrush").with("Dmtr", u(b"#Pxl", 19.0)))) + .with( + "toolOptions", + Value::Descriptor( + Descriptor::new("currentToolOptions") + .with("smoothing", Value::Boolean(false)) + .with("smoothingValue", Value::Integer(40)) + .with("smoothingRadiusMode", Value::Boolean(true)), + ), + ); + for sub in [1, 2] { + let bytes = write_v6(sub, &[], &[], std::slice::from_ref(&preset), true).unwrap(); + let imported = read_abr(&bytes, "Test").unwrap(); + let smoothing = &imported.presets[0].brush.smoothing; + assert!(!smoothing.enabled && smoothing.amount == 0.4 && smoothing.pulled_string); + } +} + #[test] fn file_folders_nest_inside_the_import_group() { let named = |n: &str| Descriptor::new("brushPreset").with("Nm ", t(n)); diff --git a/crates/paint/src/brush.rs b/crates/paint/src/brush.rs index 48e7f48d31..51d8026f31 100644 --- a/crates/paint/src/brush.rs +++ b/crates/paint/src/brush.rs @@ -441,6 +441,8 @@ impl Default for Pose { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(default, rename_all = "camelCase")] pub struct Smoothing { + /// Switch smoothing off without discarding its amount or mode. Old presets remain enabled. + pub enabled: bool, /// 0..1. pub amount: f32, /// Lazy-mouse: paint only when the pointer pulls a string of `amount × 100 px` taut. @@ -455,7 +457,7 @@ pub struct Smoothing { impl Default for Smoothing { fn default() -> Self { - Self { amount: 0.0, pulled_string: false, catch_up: true, catch_up_on_end: true, adjust_for_zoom: true } + Self { enabled: true, amount: 0.0, pulled_string: false, catch_up: true, catch_up_on_end: true, adjust_for_zoom: true } } } diff --git a/crates/paint/src/brush_tests.rs b/crates/paint/src/brush_tests.rs index 04f74ed840..371363b02a 100644 --- a/crates/paint/src/brush_tests.rs +++ b/crates/paint/src/brush_tests.rs @@ -756,6 +756,39 @@ fn smoothing_modes() { assert!(out.last().unwrap().x < 70.0, "{}", out.last().unwrap().x); } +#[test] +fn disabled_smoothing_keeps_its_settings_and_paints_unsmoothed_at_every_depth() { + let pts = vec![StrokePoint::new(10.0, 20.0, 1.0), StrokePoint::new(30.0, 8.0, 0.5), StrokePoint::new(50.0, 20.0, 0.8)]; + for pulled_string in [false, true] { + let smoothing = Smoothing { enabled: false, amount: 0.8, pulled_string, ..Default::default() }; + let got = smooth_points(&smoothing, 1.0, &pts); + assert_eq!(got.len(), pts.len()); + for (a, b) in got.iter().zip(&pts) { + assert_eq!((a.x, a.y, a.pressure), (b.x, b.y, b.pressure)); + } + let b = BrushSettings { size: 9.0, smoothing: smoothing.clone(), ..brush() }; + let zero = BrushSettings { smoothing: Smoothing { amount: 0.0, ..smoothing.clone() }, ..b.clone() }; + for fmt in [PixelFormat::RGBA8, PixelFormat::RGBA16, PixelFormat::RGBA32F] { + let (mut off, mut reference) = (Surface::new(fmt), Surface::new(fmt)); + render_stroke(&mut off, &b, &pts, None, false, 1.0); + render_stroke(&mut reference, &zero, &pts, None, false, 1.0); + for y in 0..40 { + for x in 0..64 { + assert_eq!(off.pixel(x, y), reference.pixel(x, y), "{fmt:?} at {x},{y}"); + } + } + } + // Disabling is not an amount=0 rewrite: saving and re-enabling recover the same mode. + let mut back: Smoothing = serde_json::from_value(serde_json::to_value(&smoothing).unwrap()).unwrap(); + assert_eq!(back, smoothing); + back.enabled = true; + assert!(smooth_points(&back, 1.0, &pts).iter().zip(&pts).any(|(a, b)| a.x != b.x || a.y != b.y)); + } + // Existing brush JSON has no switch and must retain its old smoothing behavior. + let legacy: Smoothing = serde_json::from_str(r#"{"amount":0.8,"pulledString":true}"#).unwrap(); + assert!(legacy.enabled && legacy.amount == 0.8 && legacy.pulled_string); +} + #[test] fn smoothing_string_runs_from_the_lagging_brush_to_the_pointer() { // #3479: the canvas draws the line between the brush and the pointer. diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs index 6fd4440264..25354dd6d5 100644 --- a/crates/paint/src/dynamics.rs +++ b/crates/paint/src/dynamics.rs @@ -62,7 +62,7 @@ impl Smoother { } fn active(&self) -> bool { - self.cfg.amount > 0.0 + self.cfg.enabled && self.cfg.amount > 0.0 } /// Feed one input point; returns the brush positions to paint through. diff --git a/crates/ui-egui/src/brush_panel.rs b/crates/ui-egui/src/brush_panel.rs index c0e877ef6d..d018219238 100644 --- a/crates/ui-egui/src/brush_panel.rs +++ b/crates/ui-egui/src/brush_panel.rs @@ -1,7 +1,7 @@ //! Window › Brush Settings (F5) and Window › Brushes: Photoshop's floating brush panel. //! -//! Brush Settings: the section list with enable boxes on the left (clicking a name shows and turns -//! on that section), the selected section's controls on the right (see [`crate::brush_sections`]), +//! Brush Settings: the section list with enable boxes on the left (clicking a controls section +//! shows and enables it; the last five rows only toggle), the selected section's controls on the right (see [`crate::brush_sections`]), //! and a live stroke preview strip below, rendered with the real brush engine and cached on the //! settings (it re-renders only when they change). Brushes: the presets in collapsible groups with //! tip thumbnails and stroke previews, a size slider and a search field. @@ -41,10 +41,17 @@ pub const SECTIONS: [(&str, bool); 13] = [ ("Noise", true), ("Wet Edges", true), ("Build-up", true), - ("Smoothing", false), + ("Smoothing", true), ("Protect Texture", true), ]; +/// The final five entries are switches, not sections with a properties pane. +const CHECKBOX_ONLY_START: usize = 8; + +fn checkbox_only(section: usize) -> bool { + (CHECKBOX_ONLY_START..SECTIONS.len()).contains(§ion) +} + /// Panel width and the stroke strip's size. pub(crate) const WIDTH: f32 = 540.0; const STRIP: (u32, u32) = (488, 76); @@ -114,7 +121,7 @@ impl Default for BrushesPanelState { } } -/// The enable flag behind section `i` (None for Brush Tip Shape and Smoothing). +/// The enable flag behind section `i` (None for Brush Tip Shape). pub fn section_flag(b: &mut BrushSettings, i: usize) -> Option<&mut bool> { Some(match i { 1 => &mut b.shape_dynamics.enabled, @@ -127,6 +134,7 @@ pub fn section_flag(b: &mut BrushSettings, i: usize) -> Option<&mut bool> { 8 => &mut b.noise, 9 => &mut b.wet_edges, 10 => &mut b.build_up, + 11 => &mut b.smoothing.enabled, 12 => &mut b.protect_texture, _ => return None, }) @@ -233,19 +241,28 @@ pub(crate) fn full_uv() -> egui::Rect { egui::Rect::from_min_max(egui::Pos2::ZERO, egui::pos2(1.0, 1.0)) } -/// The section list: enable boxes, names, locks, the selection. Clicking a name shows the section -/// and turns it on (Photoshop); clicking a box only toggles it; the lock on the right keeps the -/// section when another preset is picked. +/// Clicking a controls section shows and enables it; the final five rows only toggle, keeping +/// the current controls open. The lock on the right is a separate hit target. fn section_list(app: &mut PhotocraftApp, ui: &mut egui::Ui, b: &mut BrushSettings) { let t = Tokens::get(ui.ctx()); ui.vertical(|ui| { ui.set_width(150.0); ui.spacing_mut().item_spacing.y = 1.0; for (i, (name, has_box)) in SECTIONS.iter().enumerate() { - let sel = app.ui.brush_section == i; + let toggle_only = checkbox_only(i); + // Group the switches with whitespace, not separators between individual rows. + if i == CHECKBOX_ONLY_START { + ui.add_space(6.0); + } + let sel = !toggle_only && app.ui.brush_section == i; let (r, resp) = ui.allocate_exact_size(vec2(150.0, 23.0), Sense::click()); // Named for accessibility and for tests and agents that look sections up by name. - resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, true, sel, tl!(*name))); + if toggle_only { + let checked = section_flag(b, i).is_some_and(|flag| *flag); + resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, checked, tl!(*name))); + } else { + resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, true, sel, tl!(*name))); + } if sel { ui.painter().rect_filled(r, t.radius_sm, t.accent_soft); } else if resp.hovered() { @@ -254,10 +271,14 @@ fn section_list(app: &mut PhotocraftApp, ui: &mut egui::Ui, b: &mut BrushSetting let mut x = r.left() + 6.0; if *has_box && let Some(flag) = section_flag(b, i) { let br = egui::Rect::from_center_size(egui::pos2(x + 6.0, r.center().y), vec2(13.0, 13.0)); - let box_resp = ui.interact(br, ui.id().with(("brush-sec-box", i)), Sense::click()); - let checked = *flag; - box_resp.widget_info(|| { - egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, checked, crate::i18n::fmt(tl!("Enable {name}"), &[("name", tl!(*name))])) + // A checkbox-only row is one accessible checkbox across its whole width. A + // controls section keeps its separate enable box and selectable label. + let box_resp = (!toggle_only).then(|| { + let resp = ui.interact(br, ui.id().with(("brush-sec-box", i)), Sense::click()); + resp.widget_info(|| { + egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, *flag, crate::i18n::fmt(tl!("Enable {name}"), &[("name", tl!(*name))])) + }); + resp }); if *flag { ui.painter().rect_filled(br, 2.0, t.accent); @@ -268,9 +289,9 @@ fn section_list(app: &mut PhotocraftApp, ui: &mut egui::Ui, b: &mut BrushSetting ui.painter().rect_stroke(br, 2.0, Stroke::new(1.2, t.text_faint), egui::StrokeKind::Inside); } let on_lock = resp.interact_pointer_pos().is_some_and(|p| p.x > r.right() - 22.0); - if box_resp.clicked() { + if box_resp.is_some_and(|resp| resp.clicked()) || (toggle_only && resp.clicked() && !on_lock) { *flag = !*flag; - } else if resp.clicked() && !on_lock { + } else if !toggle_only && resp.clicked() && !on_lock { *flag = true; } x += 20.0; @@ -301,7 +322,7 @@ fn section_list(app: &mut PhotocraftApp, ui: &mut egui::Ui, b: &mut BrushSetting lock_clicked = true; } } - if resp.clicked() && !lock_clicked { + if !toggle_only && resp.clicked() && !lock_clicked { app.ui.brush_section = i; } if i == 0 { @@ -315,7 +336,12 @@ fn settings_tab(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let t = Tokens::get(ui.ctx()); let before = app.session.tools.brush.clone(); let mut b = before.clone(); - let section = app.ui.brush_section.min(SECTIONS.len() - 1); + // Older UI state and control clients could select any of the 13 entries. Switch rows no + // longer have a properties pane, so those selections recover to Brush Tip Shape. + if app.ui.brush_section >= CHECKBOX_ONLY_START { + app.ui.brush_section = 0; + } + let section = app.ui.brush_section; ui.horizontal_top(|ui| { section_list(app, ui, &mut b); widgets::vline(ui, 482.0); diff --git a/crates/ui-egui/src/brush_panel_tests.rs b/crates/ui-egui/src/brush_panel_tests.rs index 7d5a51e4fb..34dc0d9d4d 100644 --- a/crates/ui-egui/src/brush_panel_tests.rs +++ b/crates/ui-egui/src/brush_panel_tests.rs @@ -465,6 +465,140 @@ fn harness(tab: usize, section: usize) -> Harness<'static, PhotocraftApp> { h } +fn toggle_value(app: &PhotocraftApp, section: usize) -> bool { + let brush = serde_json::to_value(&app.session.tools.brush).unwrap(); + let path = match section { + 8 => "/noise", + 9 => "/wetEdges", + 10 => "/buildUp", + 11 => "/smoothing/enabled", + 12 => "/protectTexture", + _ => panic!("not a checkbox-only row"), + }; + brush.pointer(path).and_then(Value::as_bool).expect("the checkbox has a boolean brush setting") +} + +#[test] +fn checkbox_only_rows_toggle_without_changing_the_selected_controls() { + use egui_kittest::kittest::Queryable; + for (section, &(name, _)) in SECTIONS.iter().enumerate().skip(8) { + let mut h = harness(0, 1); + let before = toggle_value(h.state(), section); + let n = h.state().session.journal.len(); + h.get_by_label(name).click(); + h.run_steps(3); + assert_eq!(h.state().ui.brush_section, 1, "{name} must leave Shape Dynamics open"); + assert_eq!(toggle_value(h.state(), section), !before, "{name}"); + assert_eq!(h.state().session.journal.len(), n + 1, "one command for {name}"); + assert_eq!(last_journal(h.state()).unwrap().0, "tools.setBrush"); + h.get_by_label(name).click(); + h.run_steps(3); + assert_eq!(toggle_value(h.state(), section), before, "a second row click turns {name} back"); + assert_eq!(h.state().ui.brush_section, 1); + assert_eq!(h.state().session.journal.len(), n + 2); + } +} + +#[test] +fn checkbox_only_box_and_lock_clicks_do_not_select_or_double_toggle() { + use egui_kittest::kittest::Queryable; + for (section, &(name, _)) in SECTIONS.iter().enumerate().skip(8) { + let mut h = harness(0, 1); + let rect = h.get_by_label(name).rect(); + let before = toggle_value(h.state(), section); + let n = h.state().session.journal.len(); + let at = egui::pos2(rect.left() + 12.0, rect.center().y); + h.hover_at(at); + h.run_steps(2); + h.drag_at(at); + h.run_steps(2); + h.drop_at(at); + h.run_steps(3); + assert_eq!(toggle_value(h.state(), section), !before, "checkbox click on {name}"); + assert_eq!(h.state().ui.brush_section, 1); + assert_eq!(h.state().session.journal.len(), n + 1); + let at = egui::pos2(rect.right() - 11.0, rect.center().y); + h.hover_at(at); + h.run_steps(2); + h.drag_at(at); + h.run_steps(2); + h.drop_at(at); + h.run_steps(3); + assert_eq!(toggle_value(h.state(), section), !before, "lock click must not toggle {name}"); + assert_eq!(h.state().ui.brush_section, 1); + assert_eq!(h.state().session.journal.len(), n + 2); + let mut brush = h.state().session.tools.brush.clone(); + assert!(*section_lock(&mut brush, section).unwrap(), "{name} lock"); + } +} + +#[test] +fn checkbox_only_rows_cannot_restore_an_empty_properties_pane() { + for (section, &(name, _)) in SECTIONS.iter().enumerate().skip(8) { + let h = harness(0, section); + assert_eq!(h.state().ui.brush_section, 0, "an old selection of {name} returns to Brush Tip Shape"); + } +} + +#[test] +fn smoothing_row_preserves_its_amount_and_options_across_toggles() { + use egui_kittest::kittest::Queryable; + let mut h = harness(0, 1); + h.state_mut().run("tools.setBrush", json!({"brush": {"smoothing": {"amount": 0.65, "pulledString": true, "catchUpOnEnd": false}}})).unwrap(); + let before = h.state().session.tools.brush.smoothing.clone(); + h.run_steps(2); + for enabled in [false, true] { + h.get_by_label("Smoothing").click(); + h.run_steps(3); + let mut expected = before.clone(); + expected.enabled = enabled; + assert_eq!(h.state().session.tools.brush.smoothing, expected); + assert_eq!(h.state().ui.brush_section, 1); + assert_eq!(last_journal(h.state()).unwrap().1["brush"], json!({"smoothing": {"enabled": enabled}})); + } +} + +#[test] +fn checkbox_only_rows_are_accessible_checkboxes_and_accept_space() { + use egui::accesskit::Role; + use egui_kittest::kittest::{NodeT, Queryable}; + let mut h = harness(0, 1); + for (section, &(name, _)) in SECTIONS.iter().enumerate().skip(8) { + let node = h.get_by_label(name); + assert_eq!(node.accesskit_node().role(), Role::CheckBox, "{name}"); + node.focus(); + h.run_steps(2); + let before = toggle_value(h.state(), section); + h.key_press(egui::Key::Space); + h.run_steps(3); + assert_eq!(toggle_value(h.state(), section), !before, "Space toggles {name}"); + assert_eq!(h.state().ui.brush_section, 1); + } +} + +#[test] +fn editing_the_options_bar_amount_reenables_smoothing() { + use egui_kittest::kittest::Queryable; + let mut h = options_bar_harness(crate::state::Tool::Brush); + h.state_mut().run("tools.setBrush", json!({"brush": {"smoothing": {"enabled": false, "amount": 0.4}}})).unwrap(); + h.run_steps(3); + let n = h.state().session.journal.len(); + let label = h.get_by_label("Smoothing").rect(); + let at = egui::pos2(label.right() + 25.0, label.center().y); + h.hover_at(at); + h.run_steps(2); + h.drag_at(at); + h.run_steps(2); + h.hover_at(at + vec2(20.0, 0.0)); + h.run_steps(2); + h.drop_at(at + vec2(20.0, 0.0)); + h.run_steps(3); + let smoothing = &h.state().session.tools.brush.smoothing; + assert!(smoothing.enabled && smoothing.amount != 0.4); + assert_eq!(h.state().session.journal.len(), n + 1, "one options-bar gesture"); + assert_eq!(last_journal(h.state()).unwrap().1["brush"]["smoothing"]["enabled"], true); +} + #[test] fn preview_strip_re_renders_only_when_the_brush_changes() { let mut h = harness(0, 0); diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 0f6a1b83bf..6193717537 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -3607,6 +3607,7 @@ fn paint_mode_dropdown(ui: &mut egui::Ui, id: &str, b: &mut photocraft_engine::B fn smoothing_field(ui: &mut egui::Ui, b: &mut photocraft_engine::BrushSettings, width: f32) { let mut sm = (b.smoothing.amount * 100.0).round(); if widgets::value_field(ui, &mut sm, 0.0..=100.0, "%", width).changed() { + b.smoothing.enabled = true; b.smoothing.amount = (sm / 100.0).clamp(0.0, 1.0); } } diff --git a/docs/brush-parity.md b/docs/brush-parity.md index 119da10d66..ad1ea5c83c 100644 --- a/docs/brush-parity.md +++ b/docs/brush-parity.md @@ -1,6 +1,6 @@ # Brush and painting parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (`~` held with the Brush or Pencil erases with its brush; Clear painting mode) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (checkbox-only Brush Settings rows and non-destructive Smoothing switch) · **Target:** Adobe Photoshop 2026 Painting is where Photoshop users notice differences first, so it gets its own checklist: the brush engine (`crates/paint/src/brush.rs`), the Brush Settings UI @@ -29,6 +29,7 @@ tablets against Photoshop side by side. | Noise, Wet Edges, Build-up, Protect Texture | done | | | Smoothing: amount, Pulled String, Stroke Catch-up, Catch-up on End, Adjust for Zoom | done | `brush.rs:428-438` | | Section locks | done | #174 | +| Noise, Wet Edges, Build-up, Smoothing and Protect Texture: checkbox-only rows keep the selected controls open | done | `brush_panel_tests.rs`, #4283; Smoothing enable/disable preserves its amount and options, including imported ABR tool settings | | Brush tip from an image file | missing | TOOL-213-12 | | Erodible, Airbrush and Bristle tips (Photoshop's special tips) | partial | not audited in detail; "3D-based brushes don't work" (#1660) | | Anti-aliasing off for brushes | missing | #1666 (Pencil is the aliased path) | @@ -114,3 +115,4 @@ tablets against Photoshop side by side. |---|---|---| | 2026-10-10 | major | First version, from a source audit and the open issues | | 2026-10-11 | minor | `~` held with the Brush or Pencil erases with that tool's brush, and Clear joins their Mode menus (#3439) | +| 2026-10-12 | minor | Five Brush Settings switch rows toggle without selecting a properties pane; Smoothing has a default-on switch and retains its settings while disabled (#4283). No brush-feel estimate changed. | diff --git a/docs/gaps.md b/docs/gaps.md index d18a8655c2..01e54f1f7c 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where PhotoCraft falls short of Photoshop -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; 2026-10-11: G8: Character panel OpenType buttons landed, TYPE-218-5 stays partial; G8: triple-, quadruple- and five-click type selection landed, TYPE-218-8 done; Czech UI localization evidence added to G13; G14: D5100 crop and Camera Raw tuning validation) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (G4: checkbox-only Brush Settings rows; stroke-quality and performance gaps unchanged; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial) · **Target:** Adobe Photoshop 2026 Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact on the way to beta. This is the work list agents pick from: take the highest-ranked entry that @@ -140,6 +140,9 @@ what an agent can't finish alone. - **Estimate:** 250–400 h (many overlap with other gaps; count each fix once). ### G4. Brush feel +- **Progress (2026-10-12, #4283):** the five checkbox-only Brush Settings rows keep the open + controls selected; Smoothing can be disabled without discarding its amount or mode. This + closes that panel interaction gap, not the stroke-quality or performance gaps below. - **Missing:** lag with big brushes (#2619, #1994) and under the cursor (#2566, #1343); jumpy pressure on Windows (#2046) and tap sensitivity (#1933); stair-stepped line weights (#1776), interpolation and smoothing problems (#2138), edge falloff (#2149), pixelated cursor vs @@ -235,6 +238,7 @@ what an agent can't finish alone. | Date | Change | Summary | |---|---|---| +| 2026-10-12 | minor | G4: checkbox-only Brush Settings rows preserve the open controls and Smoothing settings (#4283); no readiness percentage or estimate changed | | 2026-10-12 | minor | G11: Load/Save Actions `.atn` landed (AUTO-219-2 partial); remaining panel work listed | | 2026-10-11 | minor | D5100 image area and Camera Raw tuning validation; G14 remains open | | 2026-10-11 | minor | G13: Czech dynamic UI text localized; engine messages and native review remain open |