alter depth first paths to use proper poly2poly parameter
This commit is contained in:
parent
afedbfb5f9
commit
3b07a089dd
2 changed files with 22 additions and 8 deletions
|
|
@ -441,6 +441,10 @@
|
|||
* @returns {Polygon[]} last offset
|
||||
*/
|
||||
function expand(polys, distance, z, out, count, distance2, collector, min) {
|
||||
// return offset(polys, [distance, distance2 || distance], {
|
||||
// z, outs: out, call: collector, minArea: min, count, flat: true
|
||||
// });
|
||||
|
||||
// prepare alignments for clipper lib
|
||||
alignWindings(polys);
|
||||
polys.forEach(function(poly) {
|
||||
|
|
@ -491,6 +495,7 @@
|
|||
|
||||
let orig = polys,
|
||||
opts = opt || {},
|
||||
count = numOrDefault(opt.count, 1),
|
||||
depth = numOrDefault(opt.depth, 0),
|
||||
clean = opts.clean !== false,
|
||||
simple = opts.simple !== false,
|
||||
|
|
@ -538,12 +543,21 @@
|
|||
opt.outs = opt.outs || [];
|
||||
// store polys in accumulator
|
||||
opt.outs.append(polys, opt.flat);
|
||||
if (opt.count > 1) {
|
||||
// callback for expand() compatibility
|
||||
if (opt.call) {
|
||||
opt.call(polys, count);
|
||||
}
|
||||
// check for more offsets
|
||||
if (count > 1) {
|
||||
// decrement count, increment depth
|
||||
opt.count--;
|
||||
opt.count = count - 1;
|
||||
opt.depth = depth + 1;
|
||||
// call next offset
|
||||
offset(polys, dist, opt);
|
||||
// } else if (count === 0) {
|
||||
// // depth = 0 means offset until failure
|
||||
// opt.depth = depth + 1;
|
||||
// offset(polys, dist, opt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue