mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
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.
This commit is contained in:
1 parent
841a3f0d39
commit
f06a8829a0
1 file changed
+10
@@ -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::*;
|
||||
|
||||
|
||||
Reference in new issue
Block a user