diff --git a/crates/ui-egui/src/canvas/paint_mouse.rs b/crates/ui-egui/src/canvas/paint_mouse.rs index 835f76ae46..b5cfab7f2b 100644 --- a/crates/ui-egui/src/canvas/paint_mouse.rs +++ b/crates/ui-egui/src/canvas/paint_mouse.rs @@ -49,7 +49,9 @@ pub fn sync_tool_brush(app: &mut PhotocraftApp) { } None => { let opacity = if tool == Tool::ArtHistoryBrush { BrushSettings::default().opacity } else { current.opacity }; - BrushSettings { smoothing: first_smoothing(), mode: photocraft_color::BlendMode::Normal, opacity, ..current } + // 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, size, ..current } } }; // The picked preset was the outgoing tool's brush: forget it, so Update Brush can't overwrite @@ -85,12 +87,16 @@ const HEALING_BRUSH_TIP: (f32, f32, f32) = (19.0, 1.0, 0.25); const TONING_TOOL_TIP: (f32, f32, f32) = (65.0, 0.0, 0.25); /// The Clone Stamp's tip after Reset Tool (#12601): a 21 px soft round at 25 % spacing. const CLONE_STAMP_TIP: (f32, f32, f32) = (21.0, 0.0, 0.25); +/// The Remove tool's size after Reset Tool (#12548): 19 px. Its hardness and spacing are not +/// measured, so they stay the default brush's. +const REMOVE_TOOL_SIZE: f32 = 19.0; /// `tool`'s brush as it starts out (Reset Tool, #2825): the default brush at Photoshop's /// smoothing, with the session's own fields of `current`. The Brush tool's tip is /// [`BRUSH_TOOL_TIP`], the Background Eraser's [`BACKGROUND_ERASER_TIP`], the Healing Brush's /// [`HEALING_BRUSH_TIP`], the Burn, Dodge and Sponge tools' [`TONING_TOOL_TIP`], the Clone Stamp's -/// [`CLONE_STAMP_TIP`] with no smoothing; the other tools keep the default tip. +/// [`CLONE_STAMP_TIP`] with no smoothing, the Remove tool's size [`REMOVE_TOOL_SIZE`]; the other +/// tools keep the default tip. pub(crate) fn fresh_brush(tool: Tool, current: &BrushSettings) -> BrushSettings { let mut brush = BrushSettings { smoothing: first_smoothing(), ..BrushSettings::default() }; match tool { @@ -102,6 +108,7 @@ pub(crate) fn fresh_brush(tool: Tool, current: &BrushSettings) -> BrushSettings (brush.size, brush.hardness, brush.spacing) = CLONE_STAMP_TIP; brush.smoothing.amount = 0.0; } + Tool::Remove => brush.size = REMOVE_TOOL_SIZE, _ => {} } session_fields(current, &brush) diff --git a/crates/ui-egui/src/canvas/remove_cursor_tests.rs b/crates/ui-egui/src/canvas/remove_cursor_tests.rs index cc4670e590..681f92ba81 100644 --- a/crates/ui-egui/src/canvas/remove_cursor_tests.rs +++ b/crates/ui-egui/src/canvas/remove_cursor_tests.rs @@ -15,6 +15,7 @@ fn harness(tool: Tool) -> Harness<'static, PhotocraftApp> { let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); app.ui.tool = tool; + crate::paint_mouse::sync_tool_brush(&mut app); app.run("tools.setBrush", json!({"brush": {"size": 40, "hardness": 1.0}})).unwrap(); app.sync_views(); app.ui.extras.rulers = false; diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 6506b65987..67f3852784 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -3141,8 +3141,9 @@ fn retouch_drags_show_the_footprint_without_wedges() { let ctx = egui::Context::default(); let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); app.run("file.new", json!({"width": 120, "height": 60})).unwrap(); - app.run("tools.setBrush", json!({"brush": {"size": 30, "hardness": hardness}})).unwrap(); app.ui.tool = Tool::Remove; + crate::paint_mouse::sync_tool_brush(&mut app); + app.run("tools.setBrush", json!({"brush": {"size": 30, "hardness": hardness}})).unwrap(); tool_event(&mut app, ToolEvent::Down { x: 20.0, y: 30.0, pressure: 1.0 }, egui::Modifiers::NONE); for i in 1..80 { let t = f64::from(i) * 0.5; diff --git a/crates/ui-egui/src/tools/retouch_ui/tests.rs b/crates/ui-egui/src/tools/retouch_ui/tests.rs index a6eba29bd2..db74c9e036 100644 --- a/crates/ui-egui/src/tools/retouch_ui/tests.rs +++ b/crates/ui-egui/src/tools/retouch_ui/tests.rs @@ -824,6 +824,7 @@ fn waiting_remove_strokes_keep_their_own_brush() { let mut app = app(); app.run("paint.pencil", json!({"points": [[0, 30], [100, 30]], "size": 200, "color": "#808080"})).unwrap(); app.ui.tool = Tool::Remove; + crate::paint_mouse::sync_tool_brush(&mut app); app.ui.tool_options.remove_after_each_stroke = false; let m = egui::Modifiers::NONE; let stroke = |app: &mut PhotocraftApp, x: f64| {