Clamp gap-first open-run dashes to the start of the run

In the x < 0 branch, a dash that starts slightly before p0 could push a
negative range. Keep the start at p0 (and the existing end cap at p0 + len).
This commit is contained in:
FredApps
2026-11-26 05:30:04 +01:00
parent ee13c648df
commit d955a3ccfc
+2 -2
View File
@@ -130,8 +130,8 @@ fn gap_first(len: f64, pattern: &[f64], period: f64) -> Vec<(f64, f64)> {
continue;
}
let b = b.min(p0 + len);
if b > a || (e == 0.0 && (p0..=p0 + len).contains(&a)) {
out.push((a - p0, b - p0));
if b > a.max(p0) || (e == 0.0 && (p0..=p0 + len).contains(&a)) {
out.push((a.max(p0) - p0, b - p0));
}
}
}