From 00f9a9c2055c3bef9c2d270a4a70b456a98daa42 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 17:44:35 -0800 Subject: [PATCH] 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`. --- crates/tools/src/draw2/gesture.rs | 2 +- crates/tools/src/draw2/gesture/tests.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index b3714eb74a..ba5e8afe9c 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -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![]; diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index ca2c88bfc2..87d18ca4b4 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -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()));