Allow tooling to treat near-zero-length handles as zero-length when converting to colinear (#2747)

fix colinear handles on connected path

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
HWienhold 2025-07-09 03:47:56 +02:00 committed by GitHub
parent d2f8c99744
commit d0e1d8982f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -1079,7 +1079,7 @@ impl ShapeState {
let mut normalized = handle_directions[0].and_then(|a| handle_directions[1].and_then(|b| (a - b).try_normalize()));
if normalized.is_none() {
if normalized.is_none() || handle_directions.iter().any(|&d| d.is_some_and(|d| d.length_squared() < f64::EPSILON * 1e5)) {
handle_directions = anchor_positions.map(|relative_anchor| relative_anchor.map(|relative_anchor| (relative_anchor - anchor) / 3.));
normalized = handle_directions[0].and_then(|a| handle_directions[1].and_then(|b| (a - b).try_normalize()))
}