From ff80f686973f12e418538e47085b8a0d6df6a0e1 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Sat, 21 Nov 2026 17:00:24 -0600 Subject: [PATCH] Smudge: Alt flips Finger Painting only at Strength 100% (CodeRabbit on #16308) Alt at a lower Strength was not measured, so it keeps following the options bar. --- crates/ui-egui/src/smudge_alt_finger_tests.rs | 13 +++++++++++-- crates/ui-egui/src/tools/retouch_ui.rs | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/smudge_alt_finger_tests.rs b/crates/ui-egui/src/smudge_alt_finger_tests.rs index 02228a4b168..06620ac4680 100644 --- a/crates/ui-egui/src/smudge_alt_finger_tests.rs +++ b/crates/ui-egui/src/smudge_alt_finger_tests.rs @@ -79,11 +79,20 @@ fn without_alt_the_checkbox_decides() { #[test] fn alt_flips_finger_painting_for_the_smudge_tool_only() { for tool in [Tool::Blur, Tool::Sharpen, Tool::Dodge, Tool::Burn] { - let mut p = json!({"fingerPainting": false}); + let mut p = json!({"strength": 100.0, "fingerPainting": false}); crate::retouch_ui::alt_finger_painting(tool, true, &mut p); assert_eq!(p["fingerPainting"], false, "{tool:?}"); } - let mut p = json!({"fingerPainting": false}); + let mut p = json!({"strength": 100.0, "fingerPainting": false}); crate::retouch_ui::alt_finger_painting(Tool::Smudge, true, &mut p); assert_eq!(p["fingerPainting"], true); } + +#[test] +fn alt_below_full_strength_keeps_the_checkbox_value() { + for on in [false, true] { + let mut p = json!({"strength": 50.0, "fingerPainting": on}); + crate::retouch_ui::alt_finger_painting(Tool::Smudge, true, &mut p); + assert_eq!(p["fingerPainting"], on, "Alt at Strength 50 % is not measured: the stroke follows the checkbox"); + } +} diff --git a/crates/ui-egui/src/tools/retouch_ui.rs b/crates/ui-egui/src/tools/retouch_ui.rs index 5bce91678fe..d7b07123ef4 100644 --- a/crates/ui-egui/src/tools/retouch_ui.rs +++ b/crates/ui-egui/src/tools/retouch_ui.rs @@ -21,10 +21,12 @@ pub(crate) fn alt_flipped(tool: Tool, alt: bool) -> Tool { } /// A Smudge stroke with ⌥ held at the press turns Finger Painting the other way for that one stroke, as in Photoshop -/// (#12957): `p` is the stroke's `paint.smudge` params. The options bar keeps its value. +/// (#12957): `p` is the stroke's `paint.smudge` params. The options bar keeps its value. Only measured at Strength +/// 100 %, so a lower Strength keeps today's behaviour (the issue's "not measured" case). pub(crate) fn alt_finger_painting(tool: Tool, alt: bool, p: &mut Value) { if tool == Tool::Smudge && alt + && p.get("strength").and_then(Value::as_f64).is_some_and(|s| s >= 100.0) && let Some(on) = p.get("fingerPainting").and_then(Value::as_bool) { p["fingerPainting"] = json!(!on);