Brushes: Filigree Arrow's shaft runs into its head with no gap

The shaft ended at x = 84 while the head's inner edge starts at about
x = 84.5 at the shaft's edges and x = 85 on its center line, so a straight
stroke drew a gap between them. The shaft now ends at x = 86, overlapping
the head without moving the tip.
This commit is contained in:
dotCooCoo
2026-11-18 14:42:09 -08:00
parent d2a44653ef
commit 51da822541
2 changed files with 22 additions and 1 deletions
+2 -1
View File
@@ -529,7 +529,8 @@ fn ornamental() -> BrushLibrary {
black(polygon(&[(60.0, 3.0), (66.0, 5.0), (72.0, -1.0), (67.0, -2.0)])),
]);
let arrow = group(vec![
black(shapes::rectangle(Rect::new(4.0, -0.7, 84.0, 0.7))),
// The shaft runs into the head's notch at x = 85 so the two overlap.
black(shapes::rectangle(Rect::new(4.0, -0.7, 86.0, 0.7))),
black(polygon(&[(80.0, -6.5), (100.0, 0.0), (80.0, 6.5), (85.0, 0.0)])),
ring(Point::new(7.0, 0.0), 4.0, 1.7),
black(polygon(&[(25.0, -0.4), (31.0, -4.4), (37.0, -2.0), (31.0, 0.8)])),
+20
View File
@@ -334,6 +334,26 @@ fn ornamental_brushes_draw_flourishes_and_survive_a_saved_library() {
assert_eq!(vectorcraft_brush::library(&reopened), lib.brushes);
}
/// Filigree Arrow's shaft runs into its head with no gap, so a straight stroke draws one arrow.
#[test]
fn the_filigree_arrow_shaft_meets_its_head() {
let s = session();
let (_, lib) = cmd::brushlib::library(&s, "Ornamental").unwrap();
let BrushKind::Art(art) = &lib.brush("Filigree Arrow").unwrap().kind else { panic!("Filigree Arrow is not an art brush") };
let mut parts = vec![];
art.art.walk(&mut |c| {
if c.path_data().is_some() {
parts.push(c.contains_fn());
}
});
for y in [-0.6, 0.0, 0.6] {
for i in 0..=930 {
let p = vectorcraft_geom::Point::new(4.05 + 0.1 * f64::from(i), y);
assert!(parts.iter().any(|inside| inside(p)), "gap at {p:?}");
}
}
}
#[test]
fn pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_library() {
let mut s = session();