revert changes
This commit is contained in:
parent
6fb589e63d
commit
6bb1df2bf0
1 changed files with 12 additions and 17 deletions
|
|
@ -620,18 +620,14 @@ function offset(polys, dist, opts = {}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
|
||||||
count = 1,
|
|
||||||
depth = 0,
|
|
||||||
fill = FillNonZero,
|
|
||||||
join = JoinType.jtMiter,
|
|
||||||
type = EndType.etClosedPolygon,
|
|
||||||
} = opts;
|
|
||||||
|
|
||||||
let orig = polys,
|
let orig = polys,
|
||||||
|
count = numOrDefault(opts.count, 1),
|
||||||
|
depth = numOrDefault(opts.depth, 0),
|
||||||
clean = opts.clean !== false,
|
clean = opts.clean !== false,
|
||||||
simple = opts.simple !== false,
|
simple = opts.simple !== false,
|
||||||
|
fill = numOrDefault(opts.fill, FillNonZero),
|
||||||
|
join = numOrDefault(opts.join, JoinType.jtMiter),
|
||||||
|
type = numOrDefault(opts.type, EndType.etClosedPolygon),
|
||||||
// if dist is array with values, shift out next offset
|
// if dist is array with values, shift out next offset
|
||||||
offs = Array.isArray(dist) ? (dist.length > 1 ? dist.shift() : dist[0]) : dist,
|
offs = Array.isArray(dist) ? (dist.length > 1 ? dist.shift() : dist[0]) : dist,
|
||||||
mina = numOrDefault(opts.minArea, 0.1),
|
mina = numOrDefault(opts.minArea, 0.1),
|
||||||
|
|
@ -667,7 +663,11 @@ function offset(polys, dist, opts = {}) {
|
||||||
|
|
||||||
// if specified, perform offset gap analysis
|
// if specified, perform offset gap analysis
|
||||||
if (opts.gaps && polys.length) {
|
if (opts.gaps && polys.length) {
|
||||||
|
let oneg = offset(polys, -offs, {
|
||||||
|
fill: opts.fill, join: opts.join, type: opts.type, z: opts.z, minArea: mina
|
||||||
|
});
|
||||||
let suba = [];
|
let suba = [];
|
||||||
|
let diff = subtract(orig, oneg, suba, null, zed);
|
||||||
opts.gaps.append(suba, opts.flat);
|
opts.gaps.append(suba, opts.flat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -678,14 +678,6 @@ function offset(polys, dist, opts = {}) {
|
||||||
|
|
||||||
// if specified, perform up to *count* successive offsets
|
// if specified, perform up to *count* successive offsets
|
||||||
if (polys.length) {
|
if (polys.length) {
|
||||||
// decrement count, increment depth
|
|
||||||
opts.count = --count;
|
|
||||||
opts.depth = ++depth;
|
|
||||||
|
|
||||||
//set poly depth
|
|
||||||
polys.forEach(p => {
|
|
||||||
p.depth = depth;
|
|
||||||
});
|
|
||||||
// ensure opts has offset accumulator array
|
// ensure opts has offset accumulator array
|
||||||
opts.outs = opts.outs || [];
|
opts.outs = opts.outs || [];
|
||||||
// store polys in accumulator
|
// store polys in accumulator
|
||||||
|
|
@ -696,6 +688,9 @@ function offset(polys, dist, opts = {}) {
|
||||||
}
|
}
|
||||||
// check for more offsets
|
// check for more offsets
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
|
// decrement count, increment depth
|
||||||
|
opts.count = count - 1;
|
||||||
|
opts.depth = depth + 1;
|
||||||
// call next offset
|
// call next offset
|
||||||
offset(polys, dist, opts);
|
offset(polys, dist, opts);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue