Pencil: the closing ring tests the point a release keeps

A Paintbrush sample dropped for being under a pixel from the last point
left the ring computed from the pointer, while the release keeps the last
point; the ring now follows that point (CodeRabbit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-24 21:21:37 +07:00
committed by bflatastic
co-authored by Claude Opus 5.5
parent c607d2b448
commit aabf48728e
+5 -1
View File
@@ -398,7 +398,11 @@ impl Tool for GestureTool {
}
self.points.truncate(1);
} else if self.points.last().is_some_and(|l| l.distance(p) < cx.tol(1.0)) || self.points.len() >= crate::MAX_STROKE_SAMPLES {
self.near_start = self.release_closes_near_start(cx, end);
// A release here keeps the last point unless it snaps (`Up`), so the ring
// follows the point `finish` will test.
let kept = self.points.last().copied().filter(|l| l.distance(p) < cx.tol(1.0) && !self.snaps());
let release_end = kept.unwrap_or(end);
self.near_start = self.release_closes_near_start(cx, release_end);
return vec![];
}
self.push(p, ev.pressure);