fix clip to when stock not set or invalid. fix client/worker signaling for null-callbacks
This commit is contained in:
parent
ebd31d8dc7
commit
603a46e432
5 changed files with 21 additions and 10 deletions
|
|
@ -28,8 +28,11 @@ let KIRI = self.kiri = self.kiri || {},
|
|||
function send(fn, data, onreply, zerocopy) {
|
||||
let seq = seqid++;
|
||||
|
||||
running[seq] = { fn:onreply };
|
||||
// console.log('send', data);
|
||||
if (onreply) {
|
||||
// track it only when we expect and can handle a reply
|
||||
running[seq] = { fn:onreply };
|
||||
}
|
||||
// console.log('send', {fn, data, onreply});
|
||||
|
||||
try {
|
||||
worker.postMessage({
|
||||
|
|
@ -59,6 +62,7 @@ KIRI.work = {
|
|||
|
||||
isBusy: function() {
|
||||
let current = 0;
|
||||
|
||||
for (let rec of Object.values(running)) {
|
||||
if (rec.fn) current++;
|
||||
}
|
||||
|
|
@ -92,7 +96,7 @@ KIRI.work = {
|
|||
let now = time(),
|
||||
reply = e.data,
|
||||
record = running[reply.seq],
|
||||
onreply = record.fn;
|
||||
onreply = record ? record.fn : undefined;
|
||||
|
||||
// console.log('recv', reply.data)
|
||||
if (reply.done) {
|
||||
|
|
@ -102,7 +106,11 @@ KIRI.work = {
|
|||
// calculate and replace recv time
|
||||
reply.time_recv = now - reply.time_recv;
|
||||
|
||||
onreply(reply.data, reply);
|
||||
if (onreply) {
|
||||
onreply(reply.data, reply);
|
||||
} else {
|
||||
console.log({unexpected_reply: reply});
|
||||
}
|
||||
};
|
||||
|
||||
restarting = false;
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@
|
|||
API.dialog.hide();
|
||||
// cancel slicing
|
||||
API.function.cancel();
|
||||
// if (KIRI.work.isSlicing()) KIRI.work.restart();
|
||||
// kill any poppers in compact mode
|
||||
UC.hidePoppers();
|
||||
// and send an event (used by FDM client)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ KIRI.worker = {
|
|||
}
|
||||
}
|
||||
}
|
||||
send.done(data.id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@
|
|||
|
||||
if (!offset) return;
|
||||
|
||||
if (process.camStockClipTo) {
|
||||
if (process.camStockClipTo && stock.x && stock.y && stock.center) {
|
||||
let rect = newPolygon().centerRectangle(stock.center, stock.x, stock.y);
|
||||
offset = cutPolys([rect], offset, slice.z, true);
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@
|
|||
CAM.addDogbones(offset, toolDiam / 5);
|
||||
}
|
||||
|
||||
if (process.camStockClipTo) {
|
||||
if (process.camStockClipTo && stock.x && stock.y && stock.center) {
|
||||
let rect = newPolygon().centerRectangle(stock.center, stock.x, stock.y);
|
||||
offset = cutPolys([rect], offset, slice.z, true);
|
||||
}
|
||||
|
|
@ -719,7 +719,8 @@
|
|||
let toolOver = toolDiam * op.step;
|
||||
let cutdir = process.camConventional;
|
||||
let polys = [];
|
||||
let stockRect = newPolygon().centerRectangle(stock.center, stock.x, stock.y);
|
||||
let stockRect = stock.center && stock.x && stock.y ?
|
||||
newPolygon().centerRectangle(stock.center, stock.x, stock.y) : undefined;
|
||||
updateToolDiams(toolDiam);
|
||||
if (tabs) {
|
||||
tabs.forEach(tab => {
|
||||
|
|
@ -746,7 +747,7 @@
|
|||
} else {
|
||||
slice.camLines = [ poly ];
|
||||
}
|
||||
if (process.camStockClipTo) {
|
||||
if (process.camStockClipTo && stockRect) {
|
||||
slice.camLines = cutPolys([stockRect], slice.camLines, z, true);
|
||||
}
|
||||
slice.output()
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@
|
|||
};
|
||||
|
||||
for (let key of Object.keys(rangeVars)) {
|
||||
UI[key].range = true;
|
||||
if (UI[key]) {
|
||||
UI[key].range = true;
|
||||
}
|
||||
}
|
||||
|
||||
function filterSynth() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue