make direction in/out configurable in code (needs ui help)
This commit is contained in:
parent
07923814c0
commit
b81c424241
1 changed files with 13 additions and 11 deletions
|
|
@ -760,26 +760,28 @@ var gs_kiri_print = exports;
|
||||||
} else {
|
} else {
|
||||||
// top object
|
// top object
|
||||||
var bounds = POLY.flatten(next.gatherOuter([]));
|
var bounds = POLY.flatten(next.gatherOuter([]));
|
||||||
// outputTraces([].appendAll(next.traces).appendAll(next.innerTraces() || []), bounds);
|
|
||||||
|
|
||||||
// outside in
|
let dir = -1; // 1 == inside out, -1 == outside-in
|
||||||
|
|
||||||
|
// output inner polygons
|
||||||
|
if (dir === 1)
|
||||||
|
outputTraces([].appendAll(next.innerTraces() || []), bounds);
|
||||||
|
|
||||||
|
// sort perimeter polygon by length to go out-to-in or in-to-out
|
||||||
(next.traces || []).sort(function(a,b) {
|
(next.traces || []).sort(function(a,b) {
|
||||||
return a.perimeter() > b.perimeter() ? -1 : 1;
|
return a.perimeter() > b.perimeter() ? dir : -dir;
|
||||||
}).forEach(function(poly, index) {
|
}).forEach(function(poly, index) {
|
||||||
outputTraces(poly, bounds);
|
outputTraces(poly, bounds);
|
||||||
});
|
});
|
||||||
// outputTraces([].appendAll(next.traces) || []), bounds); // outer first
|
|
||||||
|
|
||||||
// inside out
|
// output inner polygons
|
||||||
// (next.innerTraces() || []).sort(function(a,b) {
|
if (dir === -1)
|
||||||
// return a.perimeter() > b.perimeter() ? 1 : -1;
|
outputTraces([].appendAll(next.innerTraces() || []), bounds);
|
||||||
// }).forEach(function(poly, index) {
|
|
||||||
// outputTraces(poly, bounds);
|
|
||||||
// });
|
|
||||||
outputTraces([].appendAll(next.innerTraces() || []), bounds); // inner last
|
|
||||||
|
|
||||||
|
// then output solid and sparse fill
|
||||||
outputFills(next.fill_lines, bounds);
|
outputFills(next.fill_lines, bounds);
|
||||||
outputSparse(next.fill_sparse, bounds);
|
outputSparse(next.fill_sparse, bounds);
|
||||||
|
|
||||||
lastTop = next;
|
lastTop = next;
|
||||||
}
|
}
|
||||||
}, function(obj) {
|
}, function(obj) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue