add option to select single lines instead of polylines for traces

This commit is contained in:
Stewart Allen 2021-02-23 01:10:57 -05:00
commit 3a7922d1d3
5 changed files with 21 additions and 9 deletions

View file

@ -221,8 +221,8 @@
}
};
CAM.traces = function(settings, widget) {
if (widget.traces) {
CAM.traces = function(settings, widget, single) {
if (widget.traces && widget.trace_single === single) {
// do no work if cached
return false;
}
@ -257,7 +257,13 @@
return;
}
}
traces.push(poly);
if (single) {
poly.forEachSegment((p1, p2) => {
traces.push(newPolygon().append(p1).append(p2).setOpen());
}, poly.open);
} else {
traces.push(poly);
}
});
};
let opts = { each: oneach, over: false, flatoff: 0, edges: true, openok: true };
@ -265,6 +271,7 @@
opts.over = true;
slicer.slice(indices, opts);
widget.traces = traces;
widget.trace_single = single;
return true;
};