From f06a8829a04f226eb16b7ef4bf9a264b056b4c53 Mon Sep 17 00:00:00 2001 From: HassanKhan Date: Sat, 28 Nov 2026 12:59:44 +0500 Subject: [PATCH] Paths: a bend by nothing leaves the segment as it was A zero move no longer spreads a straight segment's handles, which could turn a smooth end's other handle and change the segment beside it. --- crates/geom/src/path.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/geom/src/path.rs b/crates/geom/src/path.rs index 95b9bae129..4c35165bb0 100644 --- a/crates/geom/src/path.rs +++ b/crates/geom/src/path.rs @@ -412,6 +412,9 @@ impl SubPath { if seg >= self.segment_count() || n == 0 { return false; } + if dv == kurbo::Vec2::ZERO { + return true; + } let mut t = t; if self.segment_is_line(seg) { let c = self.segment(seg); @@ -942,6 +945,13 @@ mod tests { let landed = sp.segment(0).nearest(grabbed + dv, 1e-9).distance_sq.sqrt(); assert!(landed < 1e-6, "t {t}: the grabbed point is {landed} off the pointer"); } + // No move leaves it as it was, a smooth end's other handle included. + let mut sp = SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(300.0, 0.0)], false); + sp.anchors[1].h_out = Point::new(300.0, 50.0); + sp.anchors[1].kind = AnchorKind::Smooth; + let before = sp.clone(); + assert!(sp.bend_segment(0, 0.5, kurbo::Vec2::ZERO)); + assert_eq!(sp.anchors, before.anchors); } use super::*;