mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 06:38:44 +00:00
Stroke: Delete and Escape skip width points hidden on a brushed stroke
Width points selected before their stroke took a brush show no handles, but the Width tool still took Delete, Backspace and Escape for them. The tool now leaves those keys to the app, as it does with no width points selected. - The Profile list shows its hover border whenever a click opens it, including on a brushed stroke with a profile, where it lists Uniform. - A test checks that the list's hover text and the Width tool's status message are the same string, so the two share their catalog rows. - An engine test checks that a press or a double-click on a brushed compound path puts the message in the status bar and runs no command. - The doc comment of Session::brushed_strokes_profiled says when type counts, and the progress-doc line names the double-click and says that art and pattern brushes do not follow a width profile yet.
This commit is contained in:
@@ -443,8 +443,9 @@ impl Session {
|
||||
///
|
||||
/// The art of graph designs is left out, and so are images and symbol instances without an
|
||||
/// active row. The result is also `None` with nothing selected, with an object inside a symbol
|
||||
/// instance selected, with type among the targets, and with a target that has no stroke row,
|
||||
/// since `stroke.set` gives such a target a plain stroke.
|
||||
/// instance selected, with type among the targets while no Appearance row is active for it,
|
||||
/// and with a target that has no stroke row, since `stroke.set` gives such a target a plain
|
||||
/// stroke.
|
||||
pub fn brushed_strokes_profiled(&self) -> Option<bool> {
|
||||
const C: &str = "stroke.set";
|
||||
let st = self.active()?;
|
||||
|
||||
@@ -40,6 +40,24 @@ fn the_width_tool_edits_a_compound_paths_stroke() {
|
||||
assert_eq!(s.journal.last().unwrap().1["id"], json!(c.0));
|
||||
}
|
||||
|
||||
/// A compound path whose stroke draws with a brush: a press or a double-click on a member puts the
|
||||
/// tool's reason in the status bar and leaves the stroke and the undo history as they were.
|
||||
#[test]
|
||||
fn the_width_tool_says_why_it_leaves_a_brushed_compound_path_alone() {
|
||||
let (mut s, c, _) = compound();
|
||||
s.execute("brush.apply", &json!({"ids": [c.0], "name": "3 pt. Round"})).unwrap();
|
||||
let steps = s.journal.len();
|
||||
let v = ViewInfo::default();
|
||||
s.select_tool("width", v).unwrap();
|
||||
for (kind, reason) in [(PointerKind::Down, true), (PointerKind::Drag, false), (PointerKind::Up, false), (PointerKind::DoubleClick, true)] {
|
||||
let ui = s.pointer(&PointerEvent::new(kind, 200.0, 301.0), v).unwrap();
|
||||
let said = ui.iter().any(|r| matches!(r, UiRequest::Status(m) if m == vectorcraft_tools::distort::KEEPS_SIZE));
|
||||
assert_eq!(said, reason, "{kind:?}: {ui:?}");
|
||||
}
|
||||
assert_eq!(profile(&s, c), None);
|
||||
assert_eq!(s.journal.len(), steps, "no command ran");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn width_point_commands_given_a_member_edit_the_compound() {
|
||||
let (mut s, c, members) = compound();
|
||||
|
||||
Reference in New Issue
Block a user