From 50d95e607795e5db98d081530e9378e563a90e7d Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Thu, 4 Mar 2021 10:35:16 -0500 Subject: [PATCH] use entirely different selector for single line traces. fixes #111 --- src/mode/cam/slice.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mode/cam/slice.js b/src/mode/cam/slice.js index 4a8600db..acc7e0d1 100644 --- a/src/mode/cam/slice.js +++ b/src/mode/cam/slice.js @@ -242,6 +242,13 @@ let traces = []; // find and trim polys (including open) to shadow let oneach = (data, index, total) => { + if (single) { + for (let line of data.lines) { + if (line.p1.distTo2D(line.p2) > 1) { + traces.push(newPolygon().append(line.p1).append(line.p2).setOpen()); + } + } + } else BASE.polygons.flatten(data.tops,null,true).forEach(poly => { poly.inner = null; poly.parent = null; @@ -257,13 +264,9 @@ return; } } - if (single) { - poly.forEachSegment((p1, p2) => { - traces.push(newPolygon().append(p1).append(p2).setOpen()); - }, poly.open); - } else { - traces.push(poly); - } + poly.forEachSegment((p1, p2) => { + traces.push(newPolygon().append(p1).append(p2).setOpen()); + }, poly.open); }); }; let opts = { each: oneach, over: false, flatoff: 0, edges: true, openok: true };