Address CodeRabbit review: start the Art History Brush's Angle and pressure toggles at their defaults on a first use

A first pick of the Art History Brush took the outgoing brush's angle and
pressure toggles, so after a Brush with 45 degrees and both toggles on the
new bar controls showed those instead of 0 degrees and off (#12629).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-11-19 18:22:40 +01:00
1 parent fcea57aa74
commit 39e7c51b44
2 files changed
+22 -1

No files matched your search

+8 -1
View File
@@ -68,7 +68,14 @@ pub fn sync_tool_brush(app: &mut PhotocraftApp) {
};
// The Remove tool starts at its measured 19 px; the rest is the current brush (#12548).
let size = if tool == Tool::Remove { REMOVE_TOOL_SIZE } else { current.size };
BrushSettings { smoothing: first_smoothing(), mode: photocraft_color::BlendMode::Normal, opacity, flow, size, ..current }
let brush = BrushSettings { smoothing: first_smoothing(), mode: photocraft_color::BlendMode::Normal, opacity, flow, size, ..current };
// The Art History Brush's Angle and pressure toggles are its own bar controls, off and
// at 0° until it changes them (#12629), whatever the outgoing brush has.
if tool == Tool::ArtHistoryBrush {
BrushSettings { angle: fresh.angle, pressure_opacity: fresh.pressure_opacity, pressure_size: fresh.pressure_size, ..brush }
} else {
brush
}
}
};
// The picked preset was the outgoing tool's brush: forget it, so Update Brush can't overwrite
@@ -141,3 +141,17 @@ fn the_bar_has_no_flow_and_no_airbrush() {
assert!(field(&h, "Flow").is_none(), "no Flow field");
assert!(h.query_by_label("Enable airbrush-style build-up effects").is_none(), "no Airbrush toggle");
}
#[test]
fn a_first_use_starts_off_and_at_0_whatever_the_outgoing_brush_has() {
let mut h = bar(Tool::Brush);
{
let b = &mut h.state_mut().session.tools.brush;
(b.pressure_opacity, b.angle, b.pressure_size) = (true, 45.0, true);
}
switch(&mut h, Tool::ArtHistoryBrush);
assert_eq!(controls(h.state()), (false, 0.0, false), "the first Art History Brush starts at its defaults");
assert!(angle_field(&h).and_then(|n| n.accesskit_node().numeric_value()) == Some(0.0), "the field shows 0°");
switch(&mut h, Tool::Brush);
assert_eq!(controls(h.state()), (true, 45.0, true), "the Brush keeps its own settings");
}