PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Brush Settings: use an amount slider for Hue Jitter (#4874)
Arif Uğur Çelikf43d019a7200
diff --git a/crates/ui-egui/src/brush_panel_tests.rs b/crates/ui-egui/src/brush_panel_tests.rsindex 6b929cd83..750a9d550 100644--- a/crates/ui-egui/src/brush_panel_tests.rs+++ b/crates/ui-egui/src/brush_panel_tests.rs@@ -560,6 +560,51 @@ fn toggle_value(app: &PhotocraftApp, section: usize) -> bool {brush.pointer(path).and_then(Value::as_bool).expect("the checkbox has a boolean brush setting")}+#[test]+fn hue_jitter_amount_edits_keep_percentage_units_and_command_routing() {+ use egui::accesskit::Role;+ use egui_kittest::kittest::{NodeT, Queryable};++ let mut h = harness(0, 5);+ h.state_mut()+ .session+ .execute(+ "tools.setBrush",+ json!({"brush": {"colorDynamics": {+ "enabled": true, "hueJitter": 0.37, "saturationJitter": 0.23, "brightnessJitter": 0.41, "purity": -0.16+ }}}),+ )+ .unwrap();+ let before = h.state().session.tools.brush.clone();+ h.run_steps(2);+ let field = h.query_all_by_role(Role::SpinButton).find(|n| n.accesskit_node().numeric_value() == Some(37.0)).unwrap();+ let center = field.rect().center();+ field.click();+ h.key_press(egui::Key::ArrowUp);+ h.run_steps(2);+ assert_eq!(h.state().session.tools.brush.color_dynamics.hue_jitter, 0.38);+ h.key_press(egui::Key::Enter);+ // Click near the high end of the track, then beyond its right edge while dragging.+ let from = egui::pos2(center.x, center.y + 24.0);+ h.event(egui::Event::PointerMoved(from));+ h.event(egui::Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE });+ h.run_steps(1);+ let to = from + vec2(200.0, 0.0);+ h.event(egui::Event::PointerMoved(to));+ h.run_steps(1);+ h.event(egui::Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });+ h.run_steps(2);+ let mut expected = before;+ expected.color_dynamics.hue_jitter = 1.0;+ assert_eq!(h.state().session.tools.brush, expected, "the amount clamps at 100% and preserves neighboring settings");+ assert_eq!(last_journal(h.state()).unwrap().0, "tools.setBrush");+ let mut replay = photocraft_engine::Session::new();+ for (id, params) in h.state().session.journal.clone() {+ replay.execute(&id, params).unwrap();+ }+ assert_eq!(replay.tools.brush, expected, "the edit remains replayable through the engine");+}+#[test]fn checkbox_only_rows_toggle_without_changing_the_selected_controls() {use egui_kittest::kittest::Queryable;diff --git a/crates/ui-egui/src/brush_sections.rs b/crates/ui-egui/src/brush_sections.rsindex db044557a..ff7ca5d29 100644--- a/crates/ui-egui/src/brush_sections.rs+++ b/crates/ui-egui/src/brush_sections.rs@@ -512,10 +512,7 @@ fn color_dynamics(ui: &mut egui::Ui, b: &mut BrushSettings) {widgets::checkbox(ui, &mut c.per_tip, tl!("Apply Per Tip"));ui.add_space(6.0);dynamic(ui, "brush-fgbg-ctl", tl!("Foreground/Background Jitter"), &mut c.fg_bg, 1.0, None, false);- let mut h = (c.hue_jitter * 100.0).round();- if widgets::slider_row(ui, tl!("Hue Jitter"), &mut h, 0.0..=100.0, "%", Some(&widgets::hue_stops())).changed() {- c.hue_jitter = (h.round() / 100.0).clamp(0.0, 1.0);- }+ pct(ui, tl!("Hue Jitter"), &mut c.hue_jitter, 1.0);pct(ui, tl!("Saturation Jitter"), &mut c.saturation_jitter, 1.0);pct(ui, tl!("Brightness Jitter"), &mut c.brightness_jitter, 1.0);signed_pct(ui, tl!("Purity"), &mut c.purity, -1.0, 1.0);@@ -648,6 +645,29 @@ mod tests {h}+ /// #3825: jitter is an amount, not a hue selector; it uses the themed amount track.+ #[test]+ fn hue_jitter_paints_an_amount_track_in_every_theme() {+ for kind in theme::ThemeKind::ALL {+ let mut b = BrushSettings::default();+ b.color_dynamics.hue_jitter = 0.37;+ let mut h = section_harness(5, b.clone());+ crate::PhotocraftApp::setup_context(&h.ctx, kind);+ h.run_steps(3);+ let label = h.get_by_label("Hue Jitter").rect();+ let t = Tokens::get(&h.ctx);+ assert!(+ h.output().shapes.iter().any(|c| matches!(&c.shape, egui::Shape::Rect(r)+ if r.rect.width() > 150.0 && (r.rect.height() - 3.0).abs() < 0.1+ && r.rect.top() > label.bottom() && r.rect.bottom() < label.bottom() + 30.0+ && r.fill == t.field_border)),+ "{kind:?}: Hue Jitter paints the same neutral track as other percentage amounts"+ );+ assert!(h.query_all_by_role(Role::SpinButton).any(|n| n.accesskit_node().numeric_value() == Some(37.0)));+ assert_eq!(h.state(), &b, "rendering does not change saved brush settings");+ }+ }+fn set_controls(b: &mut BrushSettings, control: Control) {for d in [&mut b.shape_dynamics.size,diff --git a/docs/brush-parity.md b/docs/brush-parity.mdindex 39efd3637..7a5e49982 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-13 · **Change:** minor (Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view) · **Target:** Adobe Photoshop 2026+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (Hue Jitter amount track; Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view) · **Target:** Adobe Photoshop 2026Painting is where Photoshop users notice differences first, so it gets its own checklist: thebrush engine (`crates/paint/src/brush.rs`), the Brush Settings UI@@ -24,6 +24,7 @@ tablets against Photoshop side by side.| Texture (pattern, scale, brightness, contrast, mode, depth, each tip) | done | || Dual Brush | done | || Color Dynamics (FG/BG, hue/sat/brightness jitter, purity, per tip) | done | |+| Hue Jitter uses a standard percentage-amount track instead of a hue spectrum | done | #3825 (Hue Jitter appearance only); rendered track checked in all 14 themes; numeric and pointer edits retain percentage units and engine command routing. || Transfer (opacity/flow/wetness/mix jitter and controls) | done | || Shape Dynamics and Transfer minimum fields disabled when their Control is Off, retaining their values | done | #3825 (minimum-field interaction only); `brush_sections.rs` UI regressions cover all six fields, reactivation and disabled input || Brush Pose (tilt, rotation, pressure overrides) | done | |@@ -119,3 +120,4 @@ tablets against Photoshop side by side.| 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. || 2026-10-12 | minor | A shaped tip's cursor outline turns and flips with a rotated or flipped view, and follows pixel aspect correction || 2026-10-13 | minor | Shape Dynamics and Transfer minimum inputs follow their Control and retain their values while disabled (#3825, partial). No brush-feel estimate changed. |+| 2026-10-13 | minor | Hue Jitter uses the same themed amount slider as other jitter controls (#3825, partial). No brush-feel estimate changed. |diff --git a/docs/gaps.md b/docs/gaps.mdindex f7929c276..9ad8fc851 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-13 · **Change:** minor (G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed) · **Target:** Adobe Photoshop 2026+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed) · **Target:** Adobe Photoshop 2026Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impacton the way to beta. This is the work list agents pick from: take the highest-ranked entry that@@ -151,6 +151,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-13, #3825 partial):** Hue Jitter shows a standard themed+ percentage-amount track rather than a hue spectrum. Other Brush Settings layout+ and brush-behaviour gaps remain open.- **Progress (2026-10-13, #3825 partial):** Shape Dynamics' Minimum Diameter / MinimumRoundness and Transfer's four Minimum rows disable editing when their Control is Off,retaining the configured values. The other layout and control gaps in #3825 remain open.@@ -255,6 +258,7 @@ what an agent can't finish alone.| Date | Change | Summary ||---|---|---|+| 2026-10-13 | minor | G4: Hue Jitter amount-track appearance (#3825, partial); no readiness percentage or estimate changed || 2026-10-13 | minor | G4: minimum inputs in Shape Dynamics and Transfer follow their Control (#3825, partial); no readiness percentage or estimate changed || 2026-10-12 | minor | G5: Free Transform options bar H/V skew fields done || 2026-10-12 | minor | G11: `.atn` import maps 112 events (Select and Mask, Spatter, Ripple, Crystallize, Pattern Fill, mask targeting, Step Backward, points, Bitmap) |