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