Cursors: the Smooth entry lists the Paintbrush and Blob Brush Alt cases

The cursor catalog's Smooth entry named only the Smooth tool and the
Pencil with Alt key toggles to Smooth Tool on. The tools also show it for
the Paintbrush with Alt held before a press while a path the Smooth tool
can act on is selected, and for the Blob Brush with Alt held before a
press or before the drag has moved, and through the drag that smooths.

PaintbrushClose and Paintbrush now say that Alt before a press shows the
closing ring only when no such path is selected.

The gesture tests check that the Paintbrush shows Smooth through an
Alt-press smoothing drag, with Alt let go too, and the closing ring for
Alt pressed after a stroke begins with a smoothable path selected.
This commit is contained in:
dotCooCoo
2026-11-13 07:41:08 -08:00
parent 77970c6924
commit 358eb7fe7d
2 changed files with 14 additions and 4 deletions
+4 -2
View File
@@ -599,14 +599,14 @@ look = "PencilStraight's badge with a small filled square at the line's lower en
[[cursor]]
id = "Paintbrush"
group = "Drawing and editing tools"
shown_when = ["The Paintbrush tool: draws a brushed freeform path (with pen pressure), continuing a selected path from its end; Alt closes it."]
shown_when = ["The Paintbrush tool: draws a brushed freeform path (with pen pressure), continuing a selected path from its end; Alt closes it, except that Alt held at the press with a path selected that the Smooth tool can act on smooths that path (see Smooth)."]
hotspot = "The bristle tip."
[[cursor]]
id = "PaintbrushClose"
group = "Drawing and editing tools"
shown_when = [
"The Paintbrush tool with Alt held, before a press and while drawing: releasing the mouse button with Alt still held closes the path.",
"The Paintbrush tool with Alt held while drawing, or before a press when no path is selected that the Smooth tool can act on (with one selected, Smooth shows): releasing the mouse button with Alt still held closes the path.",
"The Paintbrush tool while a stroke is drawn back to within Close Paths When Ends Are Within of its start: releasing the mouse button there closes the path.",
]
hotspot = "The bristle tip."
@@ -632,6 +632,8 @@ group = "Drawing and editing tools"
shown_when = [
"The Smooth tool: a drag along a selected path smooths it.",
"The Pencil tool with Alt key toggles to Smooth Tool on: with Alt held before a stroke begins to draw, and through a drag that smooths.",
"The Paintbrush tool with Alt held before a press while a path is selected that the Smooth tool can act on (an editable path, not a guide, with three or more anchors on one of its subpaths), and through a drag that smooths.",
"The Blob Brush tool with Alt held before a press, or before the drag has moved from the press point, and through a drag that smooths.",
]
hotspot = "The tip."
+10 -2
View File
@@ -1034,6 +1034,8 @@ fn paintbrush_alt_after_press_closes_without_smoothing_and_empty_selection_draws
let selected_cx = cx(&d, &selected, &p);
t.pointer(&selected_cx, &PointerEvent::new(PointerKind::Down, pts[0].0, pts[0].1));
t.pointer(&selected_cx, &PointerEvent::new(PointerKind::Drag, pts[1].0, pts[1].1).with_mods(alt));
// While drawing, Alt shows the closing ring though the selection could be smoothed.
assert_eq!(t.cursor(&selected_cx, Point::new(pts[1].0, pts[1].1), alt), Cursor::PaintbrushClose);
let last = t.pointer(&selected_cx, &PointerEvent::new(PointerKind::Up, pts[2].0, pts[2].1).with_mods(alt));
assert!(matches!(last.first(), Some(Action::Preview(c, v)) if c == "path.freehand" && v["closed"] == true), "{last:?}");
let cx = cx(&d, &empty, &p);
@@ -1041,7 +1043,8 @@ fn paintbrush_alt_after_press_closes_without_smoothing_and_empty_selection_draws
assert!(matches!(last.last().and_then(|a| a.first()), Some(Action::Preview(c, v)) if c == "path.freehand" && v["closed"] == true), "{last:?}");
}
/// The Paintbrush shows Smooth before an Alt press only with a selected path.
/// The Paintbrush shows Smooth before an Alt press only with a selected path, and through the
/// drag that smooths it, with Alt let go too.
#[test]
fn paintbrush_alt_cursor_matches_selection_at_press() {
let (d, id) = doc_with_rect();
@@ -1050,9 +1053,14 @@ fn paintbrush_alt_cursor_matches_selection_at_press() {
let empty = Selection::default();
let p = paint();
let alt = Mods { alt: true, ..Default::default() };
let t = GestureTool::new("paintbrush");
let mut t = GestureTool::new("paintbrush");
assert_eq!(t.cursor(&cx(&d, &selected, &p), Point::new(50.0, 150.0), alt), Cursor::Smooth);
assert_eq!(t.cursor(&cx(&d, &empty, &p), Point::new(50.0, 150.0), alt), Cursor::PaintbrushClose);
let selected_cx = cx(&d, &selected, &p);
t.pointer(&selected_cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0).with_mods(alt));
t.pointer(&selected_cx, &PointerEvent::new(PointerKind::Drag, 150.0, 150.0).with_mods(alt));
assert_eq!(t.cursor(&selected_cx, Point::new(150.0, 150.0), alt), Cursor::Smooth);
assert_eq!(t.cursor(&selected_cx, Point::new(150.0, 150.0), Mods::default()), Cursor::Smooth);
}
/// A selected text object leaves Alt Paintbrush drawing a closed stroke with its close cursor.