fixup more code broken by ai
This commit is contained in:
parent
dd2a7d0b9a
commit
76f9ce2c25
13 changed files with 161 additions and 351 deletions
|
|
@ -111,7 +111,7 @@ export const client = {
|
|||
running = {};
|
||||
worker = client.newWorker();
|
||||
|
||||
client.onmessage = worker.onmessage = function(e) {
|
||||
client.onmessage = worker.onmessage = (e) => {
|
||||
let now = time(),
|
||||
reply = e.data,
|
||||
record = running[reply.seq],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
import { newPolygon } from '../geo/polygon.js';
|
||||
import { newPolygon, Polygon } from '../geo/polygon.js';
|
||||
import { polygons as POLY } from '../geo/polygons.js';
|
||||
|
||||
export class Layers {
|
||||
|
|
@ -78,7 +78,7 @@ export class Layers {
|
|||
options.open = true;
|
||||
const polys = [];
|
||||
for (let i=0; i<lines.length-1; i += 2) {
|
||||
polys.push(new base.Polygon()
|
||||
polys.push(new Polygon()
|
||||
.append(lines[i])
|
||||
.append(lines[i+1])
|
||||
.setOpen());
|
||||
|
|
@ -94,11 +94,14 @@ export class Layers {
|
|||
|
||||
// an open or closed polygon
|
||||
addPoly(poly, options) {
|
||||
return this.addPolys([poly], options);
|
||||
return this.addPolys([ poly ], options);
|
||||
}
|
||||
|
||||
// a polygon rendered as a webgl line
|
||||
addPolys(polys, options) {
|
||||
if (!Array.isArray(polys)) {
|
||||
throw "polys must be an array";
|
||||
}
|
||||
if (polys.length === 0) {
|
||||
return this;
|
||||
}
|
||||
|
|
@ -170,8 +173,7 @@ export class Layers {
|
|||
p1.setZ(poly.z);
|
||||
p2.setZ(poly.z);
|
||||
}
|
||||
this.addPolys(p1);
|
||||
this.addPolys(p2);
|
||||
this.addPolys([ p1, p2 ]);
|
||||
}
|
||||
const color = opts.color ?
|
||||
(typeof(opts.color) === 'number' ? { line: opts.color, face: opts.color } : opts.color) :
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ async function path(levels, update, opts = {}) {
|
|||
const lasers = [];
|
||||
const sparks = [];
|
||||
const output = new Layers();
|
||||
|
||||
layers.push(output);
|
||||
|
||||
const pushPrint = (toolid, poly) => {
|
||||
|
|
|
|||
|
|
@ -752,12 +752,11 @@ class Widget {
|
|||
*/
|
||||
render(stack) {
|
||||
const mark = Date.now();
|
||||
if (this.slices)
|
||||
this.slices.forEach(slice => {
|
||||
for (let slice of this.slices || []) {
|
||||
if (slice.layers) {
|
||||
stack.add(slice.layers);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Date.now() - mark;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue