mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Remove tool: start with a 19 px brush after Reset Tool and on first use
Reset Tool gave the Remove tool the default brush's 20 px, and its first pick took the previous tool's brush. The reference measures 19 px: Reset Tool and Reset All Tools now give it 19 px, and the first pick takes 19 px and keeps the rest of the current brush, as today; hardness and spacing are not measured. Tests that set a brush before first picking the Remove tool now pick it first, so the brush they set is the Remove tool's.
This commit is contained in:
1 parent
58e0a152b9
commit
54c67c8e11
4 files changed
+13
-3
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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| {
|
||||
|
||||
Reference in new issue
Block a user