fix offsetting open polys with array offsets

This commit is contained in:
Stewart Allen 2025-12-13 16:55:56 -05:00
commit ac29d16bcc

View file

@ -600,7 +600,7 @@ export function expand(polys, distance, z, out, count, distance2, collector, min
export function offset(polys, dist, opts = {}) {
let open = opts.open ? polys.filter(p => p.open) : [];
if (open.length) {
open = open.map(p => paths.pointsToPath(p.points, dist, true));
open = open.map(p => paths.pointsToPath(p.points, Array.isArray(dist) ? dist[0] : dist, true));
open = open.map(p => newPolygon().setOpen().addPoints(p.right));
}
@ -655,7 +655,6 @@ export function offset(polys, dist, opts = {}) {
polys = fromClipperTree(tree, zed, null, null, mina);
}
// if specified, perform offset gap analysis
if (opts.gaps && polys.length) {
let oneg = offset(polys, -offs, {