Brushes: main's eraser and bristle tip tests take the stylus wheel

The Bristle tip outline reads the five pen controls and leaves the
wheel unused. The bristle tip test's pen pose gives no wheel, and the
eraser test's mode error lists `stylusWheel`.
This commit is contained in:
dotCooCoo
2026-11-18 17:44:35 -08:00
parent 4080708714
commit 00f9a9c205
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1125,7 +1125,7 @@ impl GestureTool {
let Some(name) = vectorcraft_brush::current(cx.doc) else { return vec![] };
let Some(brush) = vectorcraft_brush::find(cx.doc, &name) else { return vec![] };
let BrushKind::Bristle(bristle) = brush.kind else { return vec![] };
let [pressure, tilt, bearing, rotation] = super::pen_controls(pressure, Some(pose), super::pen_bearing(pose));
let [pressure, tilt, bearing, rotation, _] = super::pen_controls(pressure, Some(pose), super::pen_bearing(pose));
let size = bristle.size.max(0.1) * cx.paint.stroke_width.max(0.0) * (0.5 + pressure) * (1.25 - 0.5 * tilt);
if size <= 0.0 {
return vec![];
+5 -3
View File
@@ -3065,8 +3065,10 @@ fn bristle_tip_annotator_follows_a_rotation_capable_pen() {
Some(vectorcraft_geom::Shape::bounding_box(path))
};
let mut tool = GestureTool::new("paintbrush");
let at =
|rotation| PointerEvent { pen: Some(PenPose { tilt: Some([30.0, 0.0]), rotation }), ..PointerEvent::new(PointerKind::Move, 100.0, 50.0) };
let at = |rotation| PointerEvent {
pen: Some(PenPose { tilt: Some([30.0, 0.0]), rotation, wheel: None }),
..PointerEvent::new(PointerKind::Move, 100.0, 50.0)
};
assert!(bounds(&tool, &view).is_none());
tool.pointer(&view, &PointerEvent::new(PointerKind::Move, 100.0, 50.0));
assert!(bounds(&tool, &view).is_none(), "mouse");
@@ -3199,7 +3201,7 @@ fn the_eraser_tip_follows_its_variation_modes() {
assert_eq!(t.check_option(k, &json!(mode.id())), Ok(()), "{k} {mode:?}");
}
}
let modes = "must be one of `fixed`, `random`, `pressure`, `tilt`, `bearing`, `rotation`";
let modes = "must be one of `fixed`, `random`, `pressure`, `tilt`, `bearing`, `rotation`, `stylusWheel`";
assert_eq!(t.check_option("angleMode", &json!("wheel")), Err(format!("`angleMode` {modes}")));
assert_eq!(t.check_option("angleVariation", &json!(181)), Err("`angleVariation` must be a number from 0 to 180".into()));
assert_eq!(t.check_option("roundnessVariation", &json!(500)), Err("`roundnessVariation` must be a number from 0 to 100".into()));